Submission #577195

#TimeUsernameProblemLanguageResultExecution timeMemory
577195Justin1Jousting tournament (IOI12_tournament)C++14
0 / 100
1081 ms1980 KiB
#include <bits/stdc++.h> #define f first #define s second using namespace std; int ar[5005]; pair<int,int> range[5005]; int GetBestPosition(int N, int C, int R, int *K, int *S, int *E) { for (int i = 0; i < N; i++) range[i] = {i,i}; for (int i = 0; i < C; i++) { range[S[i]].s = range[E[i]].s; for (int j = E[i]+1; j < N; j++) range[j-(E[i]-S[i])] = range[j]; E[i] = range[S[i]].s, S[i] = range[S[i]].f; } int ans = 0, pos = -1; for (int i = 0; i < N; i++) { int ptr = 0; for (int j = 0; j < i; j++) ar[ptr++] = K[j]; ar[ptr++] = R; for (int j = i; j < N; j++) ar[ptr++] = K[j]; int cnt = 0; for (int j = 0; j < C; j++) { bool ok = (S[j] <= i && i <= E[j]); for (int l = S[j]; l <= E[j]; l++) { if (ar[l] > R) ok = 0; } cnt += ok; } if (cnt > ans) { ans = cnt; pos = i; } } return pos; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...