# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
25815 | 2017-06-24T08:15:53 Z | 김동현(#1079) | Space Pirate (JOI14_space_pirate) | C++14 | 16 ms | 3580 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n, e[100010], vis[100010]; vector<int> v; ll ans[100010], k; int f1(int x, ll t, int d){ if(vis[x]) return v[vis[x] + t % (d - vis[x])]; vis[x] = d; v.push_back(x); return f1(e[x], t - 1, d + 1); } int main(){ scanf("%d%lld", &n, &k); for(int i = 1; i <= n; i++) scanf("%d", e + i); if(n <= 100){ for(int i = 1; i <= n; i++){ for(int j = 1; j <= n; j++){ int pv = e[i]; e[i] = j; fill(vis + 1, vis + n + 1, 0); v.clear(); v.push_back(0); ans[f1(1, k, 1)]++; e[i] = pv; } } for(int i = 1; i <= n; i++) printf("%d\n", ans[i]); } else{ puts("0"); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 3580 KB | Output is correct |
2 | Correct | 0 ms | 3580 KB | Output is correct |
3 | Correct | 0 ms | 3580 KB | Output is correct |
4 | Correct | 3 ms | 3580 KB | Output is correct |
5 | Correct | 3 ms | 3580 KB | Output is correct |
6 | Correct | 3 ms | 3580 KB | Output is correct |
7 | Correct | 3 ms | 3580 KB | Output is correct |
8 | Correct | 3 ms | 3580 KB | Output is correct |
9 | Correct | 3 ms | 3580 KB | Output is correct |
10 | Correct | 3 ms | 3580 KB | Output is correct |
11 | Correct | 0 ms | 3580 KB | Output is correct |
12 | Correct | 3 ms | 3580 KB | Output is correct |
13 | Correct | 3 ms | 3580 KB | Output is correct |
14 | Correct | 3 ms | 3580 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 3580 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 13 ms | 3580 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 16 ms | 3580 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |