Submission #497985

# Submission time Handle Problem Language Result Execution time Memory
497985 2021-12-24T07:57:53 Z 600Mihnea Space Pirate (JOI14_space_pirate) C++17
0 / 100
2000 ms 696 KB
#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 time Memory Grader output
1 Execution timed out 2063 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2063 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2031 ms 696 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2063 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -