# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
294911 | VodkaInTheJar | The Big Prize (IOI17_prize) | C++14 | 51 ms | 384 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>
#include "prize.h"
using namespace std;
mt19937 random_generator(chrono::steady_clock::now().time_since_epoch().count());
const int maxn = 2e5 + 3;
/*
int m;
int a[maxn];
vector <int> ask(int x)
{
vector <int> ans;
ans.resize(2);
ans[0] = ans[1] = 0;
for (int i = 0; i < x; i++)
if (a[i] < a[x])
ans[0]++;
for (int i = x + 1; i < m; i++)
if (a[i] < a[x])
ans[1]++;
return ans;
}
*/
auto c = 200;
int max_sum;
int find_best(int n)
{
for (int i = 0; i < min(n, 600); i++)
{
auto curr = ask(i);
max_sum = max(max_sum, curr[0] + curr[1]);
}
for (int i = 0; i < n; )
{
auto curr = ask(i);
if (curr[0] + curr[1] == 0)
return i;
if (curr[0] + curr[1] != max_sum)
{
i++;
continue;
}
if (i + c < n)
{
auto temp = ask(i + c);
if (temp[0] == curr[0] && temp[1] == curr[1])
i += c;
else
i++;
}
else
i++;
}
}
/*
int main()
{
cin >> m;
for (int i = 0; i < m; i++)
cin >> a[i];
cout << find_best(m) << endl;
}
*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |