# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
140578 | 2019-08-03T15:25:52 Z | luciocf | 이상한 기계 (APIO19_strange_device) | C++14 | 4724 ms | 524292 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll A, B; void solve_1(void) { ll l, r; scanf("%lld %lld", &l, &r); ll x = (r-l+1)/B; ll g = A/__gcd(B+1, A); if (x >= g) printf("%lld\n", B*g); else printf("%lld\n", r-l+1); } int main(void) { int n; scanf("%d %lld %lld", &n, &A, &B); if (n == 1) { solve_1(); return 0; } set<ll> st; for (int i = 1; i <= n; i++) { ll l, r; scanf("%lld %lld", &l, &r); for (ll j = l; j <= r; j++) st.insert(j); } map<pair<ll, ll>, int> mp; int ans = 0; for (auto t: st) { ll x = (t + t/B)%A; ll y = t%B; if (!mp[{x, y}]) ans++; mp[{x, y}] = 1; } printf("%d\n", ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 165 ms | 21880 KB | Output is correct |
3 | Correct | 258 ms | 31616 KB | Output is correct |
4 | Correct | 8 ms | 1404 KB | Output is correct |
5 | Correct | 3 ms | 376 KB | Output is correct |
6 | Correct | 3 ms | 476 KB | Output is correct |
7 | Correct | 4 ms | 760 KB | Output is correct |
8 | Correct | 4 ms | 632 KB | Output is correct |
9 | Correct | 36 ms | 3956 KB | Output is correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
11 | Correct | 2 ms | 256 KB | Output is correct |
12 | Correct | 2 ms | 256 KB | Output is correct |
13 | Correct | 2 ms | 256 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 203 ms | 21444 KB | Output is correct |
16 | Correct | 92 ms | 12152 KB | Output is correct |
17 | Correct | 149 ms | 15100 KB | Output is correct |
18 | Correct | 2 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 364 KB | Output is correct |
2 | Correct | 529 ms | 62520 KB | Output is correct |
3 | Correct | 553 ms | 61740 KB | Output is correct |
4 | Correct | 526 ms | 59788 KB | Output is correct |
5 | Runtime error | 4724 ms | 524292 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 1260 ms | 112292 KB | Output is correct |
3 | Runtime error | 4707 ms | 524292 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 1260 ms | 112292 KB | Output is correct |
3 | Runtime error | 4707 ms | 524292 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 1260 ms | 112292 KB | Output is correct |
3 | Runtime error | 4707 ms | 524292 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Runtime error | 4724 ms | 524292 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 165 ms | 21880 KB | Output is correct |
3 | Correct | 258 ms | 31616 KB | Output is correct |
4 | Correct | 8 ms | 1404 KB | Output is correct |
5 | Correct | 3 ms | 376 KB | Output is correct |
6 | Correct | 3 ms | 476 KB | Output is correct |
7 | Correct | 4 ms | 760 KB | Output is correct |
8 | Correct | 4 ms | 632 KB | Output is correct |
9 | Correct | 36 ms | 3956 KB | Output is correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
11 | Correct | 2 ms | 256 KB | Output is correct |
12 | Correct | 2 ms | 256 KB | Output is correct |
13 | Correct | 2 ms | 256 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 203 ms | 21444 KB | Output is correct |
16 | Correct | 92 ms | 12152 KB | Output is correct |
17 | Correct | 149 ms | 15100 KB | Output is correct |
18 | Correct | 2 ms | 256 KB | Output is correct |
19 | Correct | 2 ms | 376 KB | Output is correct |
20 | Correct | 2 ms | 256 KB | Output is correct |
21 | Correct | 2 ms | 256 KB | Output is correct |
22 | Correct | 2 ms | 256 KB | Output is correct |
23 | Correct | 2 ms | 376 KB | Output is correct |
24 | Correct | 2 ms | 364 KB | Output is correct |
25 | Correct | 529 ms | 62520 KB | Output is correct |
26 | Correct | 553 ms | 61740 KB | Output is correct |
27 | Correct | 526 ms | 59788 KB | Output is correct |
28 | Runtime error | 4724 ms | 524292 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |