답안 #770564

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
770564 2023-07-01T13:26:12 Z Essa2006 우주 해적 (JOI14_space_pirate) C++14
10 / 100
2000 ms 2464 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl '\n'
#define FF first
#define SS second
#define all(a) a.begin(), a.end()
#define mod (ll)(1000000007)
ll n, k;
vector<int>A, Ans;
void pre(){
    A.clear(), Ans.clear();
    A.resize(n+1), Ans.resize(n+1);
}
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    cin>>n>>k;
    pre();
    for(int i=1;i<=n;i++){
        cin>>A[i];
    }
    vector<int>B=A;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            B[i]=j;
            vector<int>Vis(n+1);
            int time_=1, cur=1;
            while(true){
                if(Vis[cur]){
                    int lim=(k-time_+1)%(time_-Vis[cur]);
                    for(int f=0;f<=lim;f++){
                        if(f==lim)
                            Ans[cur]++;
                        cur=B[cur];
                    }
                    break;
                }
                Vis[cur]=time_++;
                cur=B[cur];
            }
        }
        B[i]=A[i];
    }
    for(int i=1;i<=n;i++){
        cout<<Ans[i]<<endl;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 3 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 2 ms 320 KB Output is correct
7 Correct 3 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 2 ms 320 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 2 ms 212 KB Output is correct
13 Correct 2 ms 212 KB Output is correct
14 Correct 2 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 3 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 2 ms 320 KB Output is correct
7 Correct 3 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 2 ms 320 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 2 ms 212 KB Output is correct
13 Correct 2 ms 212 KB Output is correct
14 Correct 2 ms 212 KB Output is correct
15 Execution timed out 2076 ms 340 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2074 ms 2464 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 3 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 2 ms 320 KB Output is correct
7 Correct 3 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 2 ms 320 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 2 ms 212 KB Output is correct
13 Correct 2 ms 212 KB Output is correct
14 Correct 2 ms 212 KB Output is correct
15 Execution timed out 2076 ms 340 KB Time limit exceeded
16 Halted 0 ms 0 KB -