| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 110775 | autumn_eel | 우주 해적 (JOI14_space_pirate) | C++14 | 61 ms | 512 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef pair<int,int>P;
typedef long long ll;
int a[200000];
int ans[200000];
int main(){
int n;ll K;cin>>n>>K;
if(n>100)abort();
rep(i,n){
scanf("%d",&a[i]);a[i]--;
}
rep(i,n){
int p=a[i];
rep(j,n){
a[i]=j;
int x=0,cnt=0;
map<int,int>mp;
mp[x]=0;
int b=-1;
while(cnt<K){
x=a[x];
cnt++;
if(mp.count(x)){
b=cnt-mp[x];
break;
}
else mp[x]=cnt;
}
ll d=(K-cnt)%b;
rep(k,d)x=a[x];
ans[x]++;
}
a[i]=p;
}
rep(i,n){
printf("%d\n",ans[i]);
}
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
