# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1069549 | 2024-08-22T05:28:09 Z | 김은성(#11131) | Passport (JOI23_passport) | C++17 | 2000 ms | 50528 KB |
#include <bits/stdc++.h> using namespace std; const int INF = 1.557e8; int dp[2509][2509], l[2509], r[2509]; int main(){ int n, q, t, i, j, k, x; scanf("%d", &n); for(i=1; i<=n; i++){ scanf("%d %d", &l[i], &r[i]); } scanf("%d", &q); while(q--){ scanf("%d", &x); for(i=1; i<=n; i++){ for(j=i; j<=n; j++){ dp[i][j] = INF; } } dp[x][x] = 0; for(t=0; t<n; t++){ for(i=1; i+t<=n; i++){ j = i+t; if(dp[i][j] >= INF/2) continue; for(k=i; k<=j; k++){ int ti = min(i, l[k]), tj = max(j, r[k]); dp[ti][tj] = min(dp[i][j] + 1, dp[ti][tj]); } } } if(dp[1][n] >= INF/2) dp[1][n] = -1; printf("%d\n", dp[1][n]); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Runtime error | 208 ms | 50528 KB | Execution killed with signal 11 |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 2 ms | 4444 KB | Output is correct |
12 | Correct | 3 ms | 4444 KB | Output is correct |
13 | Correct | 1 ms | 4444 KB | Output is correct |
14 | Correct | 1 ms | 2652 KB | Output is correct |
15 | Correct | 3 ms | 1628 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 2 ms | 4444 KB | Output is correct |
12 | Correct | 3 ms | 4444 KB | Output is correct |
13 | Correct | 1 ms | 4444 KB | Output is correct |
14 | Correct | 1 ms | 2652 KB | Output is correct |
15 | Correct | 3 ms | 1628 KB | Output is correct |
16 | Correct | 1620 ms | 19036 KB | Output is correct |
17 | Correct | 886 ms | 20568 KB | Output is correct |
18 | Correct | 27 ms | 20568 KB | Output is correct |
19 | Correct | 41 ms | 20056 KB | Output is correct |
20 | Execution timed out | 2056 ms | 20568 KB | Time limit exceeded |
21 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 2 ms | 4444 KB | Output is correct |
12 | Correct | 3 ms | 4444 KB | Output is correct |
13 | Correct | 1 ms | 4444 KB | Output is correct |
14 | Correct | 1 ms | 2652 KB | Output is correct |
15 | Correct | 3 ms | 1628 KB | Output is correct |
16 | Correct | 1620 ms | 19036 KB | Output is correct |
17 | Correct | 886 ms | 20568 KB | Output is correct |
18 | Correct | 27 ms | 20568 KB | Output is correct |
19 | Correct | 41 ms | 20056 KB | Output is correct |
20 | Execution timed out | 2056 ms | 20568 KB | Time limit exceeded |
21 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Runtime error | 208 ms | 50528 KB | Execution killed with signal 11 |
5 | Halted | 0 ms | 0 KB | - |