Submission #1154383

#TimeUsernameProblemLanguageResultExecution timeMemory
1154383SofiatpcJousting tournament (IOI12_tournament)C++20
0 / 100
1 ms324 KiB
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 1e5+5;
int v[MAXN];

int GetBestPosition(int n, int c, int r, int *K, int *s, int *e) {

  int ans = 0;
  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++){
      if(j == i)v[j] = r;
      else if(j < i )v[j] = K[j];
      else v[j] = K[j-1];
    }

    int cur = 0;
    for(int j = 0; j < c; j++){
      int mx = 0, qtd = 0,l;

      for(int k = 0; k < n; k++){
        if(v[k] == -1)continue;
        if(qtd == s[j])l = k;
        if(s[j] <= qtd && qtd <= e[j]){
          mx = max(mx,v[k]);
          v[k] = -1;
        }
        
        qtd++;
      }
      if(mx == r)cur++;
      v[l] = mx;
    }
    ans = max(ans,cur);
  }

  return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...