# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
541443 | MohamedFaresNebili | Jousting tournament (IOI12_tournament) | C++14 | 1089 ms | 1964 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")
using namespace std;
using ll = long long;
using ii = pair<ll, ll>;
#define ff first
#define ss second
#define pb push_back
/// #define int ll
const int MOD = 1e9 + 7;
int GetBestPosition(int N, int C, int R, int *K, int *S, int *E) {
int res = 0, curr = 0;
for(int l = 0; l < N; l++) {
vector<int> arr;
for(int i = 0; i < l; i++)
arr.pb(K[i]);
arr.pb(R);
for(int i = l; i < N - 1; i++)
arr.pb(K[i]);
int calc = 0;
for(int i = 0; i < C; i++) {
int lf = S[i], rf = E[i];
vector<int> new_arr;
for(int j = 0; j < lf; j++)
new_arr.pb(arr[j]);
int mx = -1;
for(int j = lf; j <= rf; j++)
mx = max(mx, arr[j]);
if(mx == R) calc++;
new_arr.pb(mx);
for(int j = rf + 1; j < arr.size(); j++)
new_arr.pb(arr[j]);
swap(arr, new_arr);
}
if(calc > curr) {
curr = calc, res = l;
}
}
return res;
}
Compilation message (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... |