# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
745072 | 2023-05-19T11:23:17 Z | 박상훈(#9964) | Event Hopping (BOI22_events) | C++17 | 1500 ms | 3216 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; constexpr int INF = 1e9 + 100; int n, S[100100], E[100100]; bool ok(int x, int y){ return E[x] <= E[y]; } void naive(int x, int y){ if (!ok(x, y)){ printf("impossible\n"); return; } if (x==y){ printf("0\n"); return; } int l = S[y], r = E[y], ans = 1; while(true){ if (l<=E[x] && E[x]<=r){ printf("%d\n", ans); return; } int nl = INF; for (int i=1;i<=n;i++) if (l<=E[i] && E[i]<=r){ nl = min(nl, S[i]); } if (l==nl) break; l = nl; ans++; } printf("impossible\n"); } int main(){ int q; scanf("%d %d", &n, &q); for (int i=1;i<=n;i++) scanf("%d %d", S+i, E+i); while(q--){ int x, y; scanf("%d %d", &x, &y); naive(x, y); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Execution timed out | 1572 ms | 3132 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 312 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 187 ms | 340 KB | Output is correct |
4 | Correct | 22 ms | 348 KB | Output is correct |
5 | Correct | 39 ms | 320 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 320 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 312 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 187 ms | 340 KB | Output is correct |
4 | Correct | 22 ms | 348 KB | Output is correct |
5 | Correct | 39 ms | 320 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 320 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 0 ms | 312 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 187 ms | 344 KB | Output is correct |
13 | Correct | 22 ms | 340 KB | Output is correct |
14 | Correct | 38 ms | 320 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 1 ms | 340 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 1 ms | 324 KB | Output is correct |
19 | Execution timed out | 1591 ms | 592 KB | Time limit exceeded |
20 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 312 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 187 ms | 340 KB | Output is correct |
4 | Correct | 22 ms | 348 KB | Output is correct |
5 | Correct | 39 ms | 320 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 320 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 192 ms | 336 KB | Output is correct |
13 | Correct | 23 ms | 340 KB | Output is correct |
14 | Correct | 39 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 328 KB | Output is correct |
16 | Correct | 1 ms | 320 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 1 ms | 212 KB | Output is correct |
19 | Execution timed out | 1587 ms | 2976 KB | Time limit exceeded |
20 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1570 ms | 3216 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Execution timed out | 1572 ms | 3132 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |