답안 #1084916

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1084916 2024-09-07T08:18:48 Z pemguimn 우주 해적 (JOI14_space_pirate) C++14
10 / 100
2000 ms 25416 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 1e5 + 5, LOG = 60;
int n, a[N], nxt[LOG][N];
long long cnt[N];

long long k;

int jump(int x, long long y){
    for(int i = LOG - 1; i >= 0; i--){
        if(y & (1LL << i)) x = nxt[i][x];
    }
    return x;
}
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);

    cin >> n >> k;
    for(int i = 1; i <= n; i++) cin >> a[i], nxt[0][i] = a[i];

    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            nxt[0][i] = j;
            for(int i = 1; i < LOG; i++){
                for(int j = 1; j <= n; j++){
                    nxt[i][j] = nxt[i - 1][nxt[i - 1][j]];
                }
            }
            cnt[jump(1, k)]++;
            nxt[0][i] = a[i];
        }
    }
    for(int i = 1; i <= n; i++) cout << cnt[i] << '\n';
    return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 50 ms 604 KB Output is correct
2 Correct 44 ms 604 KB Output is correct
3 Correct 45 ms 600 KB Output is correct
4 Correct 43 ms 604 KB Output is correct
5 Correct 43 ms 604 KB Output is correct
6 Correct 43 ms 748 KB Output is correct
7 Correct 44 ms 604 KB Output is correct
8 Correct 48 ms 604 KB Output is correct
9 Correct 53 ms 600 KB Output is correct
10 Correct 43 ms 604 KB Output is correct
11 Correct 43 ms 744 KB Output is correct
12 Correct 43 ms 604 KB Output is correct
13 Correct 43 ms 600 KB Output is correct
14 Correct 43 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 50 ms 604 KB Output is correct
2 Correct 44 ms 604 KB Output is correct
3 Correct 45 ms 600 KB Output is correct
4 Correct 43 ms 604 KB Output is correct
5 Correct 43 ms 604 KB Output is correct
6 Correct 43 ms 748 KB Output is correct
7 Correct 44 ms 604 KB Output is correct
8 Correct 48 ms 604 KB Output is correct
9 Correct 53 ms 600 KB Output is correct
10 Correct 43 ms 604 KB Output is correct
11 Correct 43 ms 744 KB Output is correct
12 Correct 43 ms 604 KB Output is correct
13 Correct 43 ms 600 KB Output is correct
14 Correct 43 ms 604 KB Output is correct
15 Execution timed out 2012 ms 1616 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2035 ms 25416 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 50 ms 604 KB Output is correct
2 Correct 44 ms 604 KB Output is correct
3 Correct 45 ms 600 KB Output is correct
4 Correct 43 ms 604 KB Output is correct
5 Correct 43 ms 604 KB Output is correct
6 Correct 43 ms 748 KB Output is correct
7 Correct 44 ms 604 KB Output is correct
8 Correct 48 ms 604 KB Output is correct
9 Correct 53 ms 600 KB Output is correct
10 Correct 43 ms 604 KB Output is correct
11 Correct 43 ms 744 KB Output is correct
12 Correct 43 ms 604 KB Output is correct
13 Correct 43 ms 600 KB Output is correct
14 Correct 43 ms 604 KB Output is correct
15 Execution timed out 2012 ms 1616 KB Time limit exceeded
16 Halted 0 ms 0 KB -