# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
889557 | 2023-12-20T02:18:48 Z | rukashii | Strange Device (APIO19_strange_device) | C++17 | 231 ms | 53148 KB |
#include <bits/stdc++.h> using namespace std; #define file if (fopen("input.txt", "r")) { freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); } #define int long long void setIn(string s) { freopen(s.c_str(), "r", stdin); } void setOut(string s) { freopen(s.c_str(), "w", stdout); } void setIO(string s = "") { if (s.size()) setIn(s+".inp"), setOut(s+".out"); } const int allmaxn = 1e6 + 2; int n, A, B, l[allmaxn], r[allmaxn]; namespace Sub1 { bool Check() { int S = 0; for (int i = 1; i <= n; i++) S += (r[i] - l[i] + 1); return (S <= 1e6); } void solve() { set <pair <int, int>> s; for (int i = 1; i <= n; i++) { for (int j = l[i]; j <= r[i]; j++) { s.insert({(j + j / B) % A, j % B}); } } cout << s.size(); } } // namespace Sub1 signed main() { // setIO(); file; ios::sync_with_stdio(0); cin.tie(0); cin >> n >> A >> B; for (int i = 1; i <= n; i++) cin >> l[i] >> r[i]; if (Sub1::Check()) return Sub1::solve(), 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2392 KB | Output is correct |
2 | Correct | 33 ms | 14932 KB | Output is correct |
3 | Correct | 54 ms | 20564 KB | Output is correct |
4 | Correct | 2 ms | 2908 KB | Output is correct |
5 | Correct | 1 ms | 2392 KB | Output is correct |
6 | Correct | 1 ms | 2648 KB | Output is correct |
7 | Correct | 1 ms | 2652 KB | Output is correct |
8 | Correct | 1 ms | 2396 KB | Output is correct |
9 | Correct | 6 ms | 3412 KB | Output is correct |
10 | Correct | 1 ms | 2396 KB | Output is correct |
11 | Correct | 0 ms | 2396 KB | Output is correct |
12 | Correct | 1 ms | 2396 KB | Output is correct |
13 | Correct | 1 ms | 2396 KB | Output is correct |
14 | Correct | 1 ms | 2396 KB | Output is correct |
15 | Correct | 31 ms | 9100 KB | Output is correct |
16 | Correct | 21 ms | 9308 KB | Output is correct |
17 | Correct | 43 ms | 16724 KB | Output is correct |
18 | Correct | 1 ms | 2396 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2396 KB | Output is correct |
2 | Incorrect | 0 ms | 2396 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2396 KB | Output is correct |
2 | Correct | 99 ms | 34412 KB | Output is correct |
3 | Correct | 124 ms | 34128 KB | Output is correct |
4 | Correct | 101 ms | 32596 KB | Output is correct |
5 | Incorrect | 175 ms | 41120 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2392 KB | Output is correct |
2 | Incorrect | 231 ms | 53148 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2392 KB | Output is correct |
2 | Incorrect | 231 ms | 53148 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2392 KB | Output is correct |
2 | Incorrect | 231 ms | 53148 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2396 KB | Output is correct |
2 | Incorrect | 28 ms | 10372 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2392 KB | Output is correct |
2 | Correct | 33 ms | 14932 KB | Output is correct |
3 | Correct | 54 ms | 20564 KB | Output is correct |
4 | Correct | 2 ms | 2908 KB | Output is correct |
5 | Correct | 1 ms | 2392 KB | Output is correct |
6 | Correct | 1 ms | 2648 KB | Output is correct |
7 | Correct | 1 ms | 2652 KB | Output is correct |
8 | Correct | 1 ms | 2396 KB | Output is correct |
9 | Correct | 6 ms | 3412 KB | Output is correct |
10 | Correct | 1 ms | 2396 KB | Output is correct |
11 | Correct | 0 ms | 2396 KB | Output is correct |
12 | Correct | 1 ms | 2396 KB | Output is correct |
13 | Correct | 1 ms | 2396 KB | Output is correct |
14 | Correct | 1 ms | 2396 KB | Output is correct |
15 | Correct | 31 ms | 9100 KB | Output is correct |
16 | Correct | 21 ms | 9308 KB | Output is correct |
17 | Correct | 43 ms | 16724 KB | Output is correct |
18 | Correct | 1 ms | 2396 KB | Output is correct |
19 | Correct | 0 ms | 2396 KB | Output is correct |
20 | Incorrect | 0 ms | 2396 KB | Output isn't correct |
21 | Halted | 0 ms | 0 KB | - |