結果

問題 No.849 yuki国の分割統治
ユーザー risujirohrisujiroh
提出日時 2019-07-05 23:16:18
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 595 bytes
コンパイル時間 1,714 ms
コンパイル使用メモリ 173,960 KB
実行使用メモリ 8,704 KB
最終ジャッジ日時 2024-10-06 23:03:00
合計ジャッジ時間 4,325 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 25 RE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  lint a, b, c, d; cin >> a >> b >> c >> d;
  while (a) {
    lint q = c / a;
    swap(c -= q * a, a);
    swap(d -= q * b, b);
  }
  b = abs(b);
  int n; cin >> n;
  set< pair<lint, lint> > se;
  while (n--) {
    lint x, y; cin >> x >> y;
    lint q = x / c;
    x -= q * c;
    y -= q * d;
    se.emplace(x, b ? (y % b + b) % b : y);
  }
  cout << se.size() << '\n';
}
0