| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 363082 | casperwang | Jousting tournament (IOI12_tournament) | C++14 | 1097 ms | 1384 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>
#define pb emplace_back
#define pii pair<int,int>
#define ff first
#define ss second
using namespace std;
#define debug(args...) kout("[ " + string(#args) + " ]", args)
void kout() { cerr << endl; }
template <class T, class ...U> void kout(T a, U ...b) { cerr << a << ' ',kout(b...); }
template <class T> void pary(T L, T R) { while (L != R) cerr << *L << " \n"[++L==R]; }
int solve(int id, int N, int C, int R, int *K, int *S, int *E) {
vector <int> now;
for (int i = 0; i+1 < N; i++) {
if (now.size() == id) now.pb(R);
now.pb(K[i]);
}
if (now.size() == id) now.pb(R);
vector <int> tmp;
int cnt = 0;
for (int i = 0; i < C; i++) {
pii mmax = pii(-1, -1);
bool flag = false;
for (int j = S[i]; j <= E[i]; j++) {
mmax = max(mmax, pii(now[j], j));
flag |= (now[j] == R);
}
if (mmax.ff == R) cnt++;
else if (flag) return cnt;
for (int j = 0; j < now.size(); j++)
if (j < S[i] || j > E[i] || j == mmax.ss)
tmp.pb(now[j]);
now = tmp; tmp.clear();
}
return cnt;
}
int GetBestPosition(int N, int C, int R, int *K, int *S, int *E) {
pii ans = pii(0, 0);
for (int i = 0; i < N; i++)
ans = max(ans, pii(solve(i, N, C, R, K, S, E), -i));
return -ans.ss;
}
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... | ||||
