Submission #497985

#TimeUsernameProblemLanguageResultExecution timeMemory
497985600MihneaSpace Pirate (JOI14_space_pirate)C++17
0 / 100
2063 ms696 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = (int) 1e5 + 7; int n; int nxt[N]; ll solution[N]; ll k; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n >> k; for (int i = 1; i <= n; i++) { cin >> nxt[i]; } for (int a = 1; a <= n; a++) { int init = nxt[a]; for (int b = 1; b <= n; b++) { nxt[a] = b; int current = 1; for (ll step = 1; step <= k; step++) { current = nxt[current]; } solution[current]++; } nxt[a] = init; } for (int i = 1; i <= n; i++) { cout << solution[i] << "\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...