제출 #754189

#제출 시각아이디문제언어결과실행 시간메모리
754189nicksms마상시합 토너먼트 (IOI12_tournament)C++17
100 / 100
177 ms5988 KiB
#include <bits/extc++.h> int a[100001],s[100001],e[100001]; int GetBestPosition(int N, int C, int R, int *K, int *S, int *E) { struct p {int x,y;}; __gnu_cxx::rope<p> g; int cnt = 0; for (int i = 0; i < N-1; i++) if (K[i] > R) s[i+1]++,e[i]++,cnt++; for (int i = 0; i < N; i++) s[i+1]+=s[i],e[N-1-i]+=e[N-i],g.push_back({i,i}); for (int i = 0; i < C; i++) { int l=g[S[i]].x,r=g[E[i]].y; g.erase(S[i],E[i]-S[i]+1); g.insert(S[i],{l,r}); if (s[l]+e[r]==cnt) a[l]++,a[r+1]--; } int c=a[0],b=c,j=0; for (int i = 1; i <= N; i++) if (b < (c+=a[i])) b=c,j=i; return j; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...