# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
629510 | 2022-08-14T15:00:43 Z | Cyber_Wolf | Strange Device (APIO19_strange_device) | C++14 | 5000 ms | 524288 KB |
// Problem: P1 - Strange Device // Contest: DMOJ - APIO '19 // URL: https://dmoj.ca/problem/apio19p1 // Memory Limit: 512 MB // Time Limit: 1800 ms // // Powered by CP Editor (https://cpeditor.org) #include <bits/stdc++.h> using namespace std; #define lg long long #define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int main() { fastio; lg n, a, b; cin >> n >> a >> b; vector<pair<lg, lg>> v(n); set<pair<lg, lg>> se; lg ans = 0; for(int i = 0; i < n; i++) { cin >> v[i].first >> v[i].second; } for(auto [x, y] : v) { for(int j = x; j <= y; j++) { pair<lg, lg> p = {(j+j/b)%a, j%b}; auto it = se.find(p); if(it == se.end()) { se.insert(p); ans++; } } } cout << ans << '\n'; /*for(int i = 1; i <= 10; i++) { cout << (i+i/b)%a << ' ' << i%b << '\n'; }*/ // cout << min(a*b, v[0][1]-v[0][0]+1) << '\n'; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Execution timed out | 5097 ms | 405576 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Execution timed out | 5033 ms | 524288 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Execution timed out | 5091 ms | 60668 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Execution timed out | 5031 ms | 117128 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Execution timed out | 5031 ms | 117128 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Execution timed out | 5031 ms | 117128 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Runtime error | 2041 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 | Execution timed out | 5097 ms | 405576 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |