제출 #64683

#제출 시각아이디문제언어결과실행 시간메모리
64683Vahan마상시합 토너먼트 (IOI12_tournament)C++17
49 / 100
1089 ms120908 KiB
#include<vector> using namespace std; vector<int> g[5000000]; int a[5000000],o=-1,f; void hetqc(int x,int y,int nn) { for(int i=y;i<nn;i++) a[i]=a[i-y+x]; } int GetBestPosition(int N, int C, int R, int *K, int *S, int *E) { int n=N; int t=n; for(int i=0;i<n;i++) a[i]=i; int nn=n; for(int i=0;i<C;i++) { for(int j=S[i];j<=E[i];j++) g[t].push_back(a[j]); a[S[i]]=t; t++; nn-=E[i]-S[i]; hetqc(E[i]+1,S[i]+1,nn); } for(int i=0;i<n;i++) { int e=0; for(int j=0;j<n;j++) { if(i==j) { a[j]=R; e=1; } else if(e==0) a[j]=K[j]; else a[j]=K[j-1]; } int q=0; for(int j=n;j<t;j++) a[j]=-1; for(int j=n;j<t;j++) { for(int e=0;e<g[j].size();e++) a[j]=max(a[j],a[g[j][e]]); if(a[j]==R) q++; } if(q>o) { o=q; f=i; } } return f; }

컴파일 시 표준 에러 (stderr) 메시지

tournament.cpp: In function 'int GetBestPosition(int, int, int, int*, int*, int*)':
tournament.cpp:46:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int e=0;e<g[j].size();e++)
                         ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...