# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
761169 | fatemetmhr | Jousting tournament (IOI12_tournament) | C++17 | 1073 ms | 1228 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.
// ~ Be Name Khoda ~ //
#include <bits/stdc++.h>
//#pragma GCC optimize ("O3")
//#pragma GCC target("avx2")
//#pragma GCC optimize("unroll-loops,Ofast")
using namespace std;
typedef long long ll;
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define fi first
#define se second
const int maxn = 1e6 + 10;
const int maxn5 = 5e5 + 10;
const int maxnt = 1.2e6 + 10;
const int maxn3 = 1e3 + 10;
const int mod = 1e9 + 7;
const ll inf = 1e18;
vector <int> tmp, av;
int GetBestPosition(int n, int c, int r, int *k, int *s, int *e){
int mx = 0, out = 0;
for(int tt = 0; tt < n; tt++){
av.clear();
for(int i = 0; i < tt; i++)
av.pb(k[i]);
av.pb(r);
for(int i = tt; i < n - 1; i++)
av.pb(k[i]);
int val = 0;
for(int i = 0; i < c; i++){
tmp.clear();
for(int j = 0; j < s[i]; j++)
tmp.pb(av[j]);
int mx = 0;
for(int j = s[i]; j <= e[i]; j++)
mx = max(mx, av[j]);
tmp.pb(mx);
//cout << "hen? " << tt << ' ' << i << ' ' << s[i] << ' ' << e[i] << ' ' << mx << endl;
if(mx == r)
val++;
for(int j = e[i]; j < av.size(); j++)
tmp.pb(av[j]);
tmp.clear();
for(auto u : tmp)
av.pb(u);
}
if(val > mx){
mx = val;
out = tt;
}
//cout << tt << ' ' << val << endl;
}
return out;
}
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... |