Submission #781470

# Submission time Handle Problem Language Result Execution time Memory
781470 2023-07-13T06:46:03 Z christinelynn Strange Device (APIO19_strange_device) C++17
10 / 100
5000 ms 524288 KB
#include<bits/stdc++.h>
#define int long long
#define pii pair<int, int>
using namespace std;
signed main() {
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  int n, a, b; cin >> n >> a >> b;
  priority_queue<pii, vector<pii>, greater<pii>> pq;
  set<pair<int, int>> ans;
  while(n--) {
    int l, r; cin >> l >> r;
    pq.push({l, r});
  }
  while(!pq.empty()) {
    int i=pq.top().first, j=pq.top().second;
    pq.pop();
    while(i<=j) {
      while(!pq.empty() && pq.top().first==i) j=max(j, pq.top().second);
      ans.insert({(i+i/b)%a, i%b});
      i++;
    }
  }
  cout << ans.size() << '\n';
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 35 ms 12612 KB Output is correct
3 Correct 57 ms 18136 KB Output is correct
4 Correct 2 ms 852 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 6 ms 1120 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 32 ms 7000 KB Output is correct
16 Correct 21 ms 6908 KB Output is correct
17 Correct 60 ms 8148 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Runtime error 2510 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 102 ms 32288 KB Output is correct
3 Correct 129 ms 32068 KB Output is correct
4 Correct 107 ms 30524 KB Output is correct
5 Execution timed out 5089 ms 103328 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 252 KB Output is correct
2 Correct 509 ms 78520 KB Output is correct
3 Runtime error 1665 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 252 KB Output is correct
2 Correct 509 ms 78520 KB Output is correct
3 Runtime error 1665 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 252 KB Output is correct
2 Correct 509 ms 78520 KB Output is correct
3 Runtime error 1665 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 Runtime error 1297 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 35 ms 12612 KB Output is correct
3 Correct 57 ms 18136 KB Output is correct
4 Correct 2 ms 852 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 6 ms 1120 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 32 ms 7000 KB Output is correct
16 Correct 21 ms 6908 KB Output is correct
17 Correct 60 ms 8148 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Runtime error 2510 ms 524288 KB Execution killed with signal 9
21 Halted 0 ms 0 KB -