結果

問題 No.849 yuki国の分割統治
ユーザー beet
提出日時 2019-07-05 22:45:08
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 584 bytes
コンパイル時間 2,243 ms
コンパイル使用メモリ 198,664 KB
最終ジャッジ日時 2025-01-07 06:04:48
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 18 WA * 8
権限があれば一括ダウンロードができます

ソースコード

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