제출 #781618

#제출 시각아이디문제언어결과실행 시간메모리
781618andecaandeciStrange Device (APIO19_strange_device)C++17
10 / 100
5032 ms524288 KiB
#include <bits/stdc++.h>
using namespace std;

#define int long long

set<pair<int, int>> unik;

signed main() {
  int n, a, b, l, r, x, y;
  cin >> n >> a >> b;
  // kpk = lcm(a, b);
  // cout << kpk << endl;
  for (int i = 0; i < n; i++) {
    cin >> l >> r;
    for (int j = l; j <= r; j++) {
      x = (j + (j/b))%a;
      y = j%b;
      unik.insert({x, y});
    }
  }
  cout << unik.size() << endl;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...