| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 314985 | amunduzbaev | 마상시합 토너먼트 (IOI12_tournament) | C++14 | 18 ms | 2048 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//#include "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
int n, c, last, k[505], s[505], e[505], tmp[505], used[505], tmp2[505];
int solve(int pos){
int j=0;
for(int i=0;i<n;i++) tmp[i]=tmp2[i];
int done=0;
for(int i=0;i<c;i++){
int l=s[i], r=e[i],m=0;
for(;l<=r;l++)
m=max(m,tmp[l]);
l=s[i];
for(;l<=r;l++)
tmp[l]=m;
if(m==last){ pos=r, j++;}
if(tmp[pos]!=last)
return j;
}
return j;
}
int GetBestPosition(int N, int C, int R, int *K, int *S, int *E) {
n=N, c=C, last=R;
for(int i=0;i<n-1;i++) k[i]=K[i];
for(int i=0;i<c;i++) s[i]=S[i],e[i]=E[i];
tmp2[0]=last;
for(int i=1;i<n;i++){
tmp2[i]=k[i-1];
}
for(int i=0;i<c;i++){
int l=s[i],r=e[i];
if(s[i+1]>=l){
s[i+1]+=(r-l);
}
if(e[i+1]>=l){
e[i+1]+=(r-l);
}
}
int ans,mx=0;
for(int pos=0;pos<n;pos++){
int sl=solve(pos);
if(sl>mx){
mx=sl;
ans=pos;
}
swap(tmp2[pos],tmp2[pos+1]);
}
return ans;
}
/*
5 3
3
1 0 2 4
1 3
0 1
0 1
*/
컴파일 시 표준 에러 (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... | ||||
