結果

問題 No.849 yuki国の分割統治
ユーザー beetbeet
提出日時 2019-07-05 22:45:08
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 584 bytes
コンパイル時間 2,299 ms
コンパイル使用メモリ 202,356 KB
実行使用メモリ 8,192 KB
最終ジャッジ日時 2024-04-16 07:54:49
合計ジャッジ時間 5,536 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 101 ms
6,940 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 89 ms
6,940 KB
testcase_12 AC 98 ms
6,940 KB
testcase_13 WA -
testcase_14 AC 102 ms
6,944 KB
testcase_15 AC 91 ms
6,944 KB
testcase_16 AC 117 ms
7,040 KB
testcase_17 AC 96 ms
6,940 KB
testcase_18 AC 119 ms
7,168 KB
testcase_19 AC 103 ms
6,940 KB
testcase_20 AC 112 ms
6,940 KB
testcase_21 AC 88 ms
6,944 KB
testcase_22 WA -
testcase_23 AC 114 ms
6,940 KB
testcase_24 AC 103 ms
6,940 KB
testcase_25 AC 123 ms
8,192 KB
testcase_26 AC 2 ms
6,940 KB
testcase_27 AC 2 ms
6,940 KB
testcase_28 AC 2 ms
6,940 KB
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


//INSERT ABOVE HERE
signed main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  int n;
  cin>>n;
  vector<int> xs(n),ys(n);
  for(int i=0;i<n;i++) cin>>xs[i]>>ys[i];

  int gx=__gcd(a,c);
  int gy=__gcd(b,d);

  using P = pair<int, int>;
  set<P> sp;
  for(int i=0;i<n;i++)
    sp.emplace(gx?xs[i]%gx:xs[i],gy?ys[i]%gy:ys[i]);

  cout<<sp.size()<<endl;
  return 0;
}
0