Submission #839347

# Submission time Handle Problem Language Result Execution time Memory
839347 2023-08-29T19:08:11 Z tch1cherin Strange Device (APIO19_strange_device) C++17
10 / 100
1541 ms 524288 KB
#include <bits/stdc++.h>
using namespace std;

const long long INF = 2e18;

int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  int N;
  long long A, B;
  cin >> N >> A >> B;
  long long AI = A / gcd(A, B + 1);
  long long M = INF / AI >= B ? AI * B : INF;   
  vector<long long> rem;
  for (int i = 0; i < N; i++) {
    long long L, R;
    cin >> L >> R;
    for (auto i = L; i <= R; i++) {
      rem.push_back(i % M);
    }
  }
  sort(rem.begin(), rem.end());
  cout << (unique(rem.begin(), rem.end()) - rem.begin()) << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 10 ms 2640 KB Output is correct
3 Correct 25 ms 4684 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 3 ms 984 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 15 ms 4556 KB Output is correct
16 Correct 11 ms 1620 KB Output is correct
17 Correct 33 ms 1484 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Runtime error 430 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 31 ms 8648 KB Output is correct
3 Correct 31 ms 8648 KB Output is correct
4 Correct 29 ms 8648 KB Output is correct
5 Runtime error 442 ms 524288 KB Execution killed with signal 9
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 279 ms 8644 KB Output is correct
3 Runtime error 544 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 279 ms 8644 KB Output is correct
3 Runtime error 544 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 279 ms 8644 KB Output is correct
3 Runtime error 544 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1541 ms 263036 KB Output is correct
3 Runtime error 527 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 10 ms 2640 KB Output is correct
3 Correct 25 ms 4684 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 3 ms 984 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 15 ms 4556 KB Output is correct
16 Correct 11 ms 1620 KB Output is correct
17 Correct 33 ms 1484 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Runtime error 430 ms 524288 KB Execution killed with signal 9
21 Halted 0 ms 0 KB -