# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
611836 | 2022-07-29T08:01:43 Z | qwerasdfzxcl | Space Pirate (JOI14_space_pirate) | C++14 | 2000 ms | 2380 KB |
#include <bits/stdc++.h> typedef long long ll; using namespace std; int adj[100100], idx[100100]; ll ans[100100], t; void solve(int a, int b){ int org = adj[a]; adj[a] = b; vector<int> V = {0}; int i; ll cur = t, len = 0; for (i=1;;i=adj[i]){ if (idx[i]) {len = (int)V.size() - idx[i]; break;} V.push_back(i); idx[i] = (int)V.size()-1; --cur; } cur %= len; for (;cur;cur--){ i = adj[i]; } ans[i]++; for (auto &x:V) idx[x] = 0; adj[a] = org; } int main(){ int n; scanf("%d %lld", &n, &t); for (int i=1;i<=n;i++) scanf("%d", adj+i); for (int i=1;i<=n;i++){ for (int j=1;j<=n;j++) solve(i, j); } for (int i=1;i<=n;i++) printf("%lld\n", ans[i]); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 308 KB | Output is correct |
2 | Correct | 4 ms | 212 KB | Output is correct |
3 | Correct | 3 ms | 212 KB | Output is correct |
4 | Correct | 9 ms | 212 KB | Output is correct |
5 | Correct | 8 ms | 212 KB | Output is correct |
6 | Correct | 6 ms | 212 KB | Output is correct |
7 | Correct | 10 ms | 320 KB | Output is correct |
8 | Correct | 6 ms | 212 KB | Output is correct |
9 | Correct | 9 ms | 312 KB | Output is correct |
10 | Correct | 7 ms | 324 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 9 ms | 340 KB | Output is correct |
13 | Correct | 6 ms | 212 KB | Output is correct |
14 | Correct | 6 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 308 KB | Output is correct |
2 | Correct | 4 ms | 212 KB | Output is correct |
3 | Correct | 3 ms | 212 KB | Output is correct |
4 | Correct | 9 ms | 212 KB | Output is correct |
5 | Correct | 8 ms | 212 KB | Output is correct |
6 | Correct | 6 ms | 212 KB | Output is correct |
7 | Correct | 10 ms | 320 KB | Output is correct |
8 | Correct | 6 ms | 212 KB | Output is correct |
9 | Correct | 9 ms | 312 KB | Output is correct |
10 | Correct | 7 ms | 324 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 9 ms | 340 KB | Output is correct |
13 | Correct | 6 ms | 212 KB | Output is correct |
14 | Correct | 6 ms | 212 KB | Output is correct |
15 | Execution timed out | 2072 ms | 352 KB | Time limit exceeded |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2068 ms | 2380 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 308 KB | Output is correct |
2 | Correct | 4 ms | 212 KB | Output is correct |
3 | Correct | 3 ms | 212 KB | Output is correct |
4 | Correct | 9 ms | 212 KB | Output is correct |
5 | Correct | 8 ms | 212 KB | Output is correct |
6 | Correct | 6 ms | 212 KB | Output is correct |
7 | Correct | 10 ms | 320 KB | Output is correct |
8 | Correct | 6 ms | 212 KB | Output is correct |
9 | Correct | 9 ms | 312 KB | Output is correct |
10 | Correct | 7 ms | 324 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 9 ms | 340 KB | Output is correct |
13 | Correct | 6 ms | 212 KB | Output is correct |
14 | Correct | 6 ms | 212 KB | Output is correct |
15 | Execution timed out | 2072 ms | 352 KB | Time limit exceeded |
16 | Halted | 0 ms | 0 KB | - |