結果

問題 No.321 (P,Q)-サンタと街の子供たち
ユーザー imulanimulan
提出日時 2017-10-18 17:50:43
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 863 bytes
コンパイル時間 1,531 ms
コンパイル使用メモリ 163,996 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-11 20:28:39
合計ジャッジ時間 7,596 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 RE -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 2 ms
4,380 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 1 ms
4,376 KB
testcase_12 WA -
testcase_13 AC 1 ms
4,380 KB
testcase_14 WA -
testcase_15 AC 78 ms
4,376 KB
testcase_16 WA -
testcase_17 AC 1 ms
4,376 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 46 ms
4,380 KB
testcase_22 WA -
testcase_23 AC 66 ms
4,380 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 87 ms
4,380 KB
testcase_30 AC 4 ms
4,376 KB
testcase_31 WA -
testcase_32 AC 42 ms
4,380 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 72 ms
4,376 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 AC 15 ms
4,380 KB
testcase_40 WA -
testcase_41 AC 24 ms
4,380 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

int solve(ll p, ll q, ll x, ll y)
{
    ll a = p+q, b = p-q;
    ll g = __gcd(a,b);
    ll c = abs(x+y);
    return (c%g==0);
}

int main()
{
    ll p,q;
    cin >>p >>q;
    if(p<q) swap(p,q);

    int n;
    cin >>n;

    int ans = 0;
    while(n--)
    {
        ll x,y;
        cin >>x >>y;
        ans += solve(p,q,x,y);
    }
    cout << ans << endl;
    return 0;
}
0