#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll linf = ll(1e18);
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> p2;
#define rep(i, high) for (int i = 0; i < high; i++)
#define repp(i, low, high) for (int i = low; i < high; i++)
#define repe(i, container) for (auto& i : container)
#define sz(container) ((int)container.size())
#define all(x) begin(x),end(x)
#if _LOCAL
#define assert(x) if (!(x)) __debugbreak()
#endif
int find_best(int n) {
int a = 9000;
int b = 4000;
vector<p2> density(n);
rep(i, n) density[i].second = i;
uniform_int_distribution<int> dist(1, n - 2);
mt19937 rng(10);
rep(i, a)
{
int p = dist(rng);
vi res = ask(p);
//rep(i, p) density[i].first += res[0];
//repp(i, p+1,n) density[i].first += res[1];
density[0].first += res[0];
density[p].first -= res[0];
density[p + 1].first += res[1];
}
repp(i, 1, n) density[i].first += density[i - 1].first;
sort(density.rbegin(), density.rend());
repe(u, density)
{
vi res = ask(u.second);
if (res[0]==0&&res[1]==0)
{
return u.second;
}
}
return 0;
}
Compilation message
prize.cpp: In function 'int find_best(int)':
prize.cpp:25:6: warning: unused variable 'b' [-Wunused-variable]
25 | int b = 4000;
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
71 ms |
2132 KB |
Output is correct |
2 |
Correct |
67 ms |
1988 KB |
Output is correct |
3 |
Correct |
57 ms |
1880 KB |
Output is correct |
4 |
Correct |
59 ms |
1880 KB |
Output is correct |
5 |
Correct |
58 ms |
1880 KB |
Output is correct |
6 |
Correct |
47 ms |
1880 KB |
Output is correct |
7 |
Correct |
47 ms |
2128 KB |
Output is correct |
8 |
Correct |
62 ms |
1880 KB |
Output is correct |
9 |
Correct |
55 ms |
1880 KB |
Output is correct |
10 |
Correct |
60 ms |
1880 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
45 ms |
1880 KB |
Partially correct - number of queries: 9012 |
2 |
Partially correct |
60 ms |
1880 KB |
Partially correct - number of queries: 9025 |
3 |
Partially correct |
48 ms |
1880 KB |
Partially correct - number of queries: 9006 |
4 |
Partially correct |
47 ms |
1880 KB |
Partially correct - number of queries: 9001 |
5 |
Partially correct |
56 ms |
1880 KB |
Partially correct - number of queries: 9008 |
6 |
Partially correct |
55 ms |
1880 KB |
Partially correct - number of queries: 9022 |
7 |
Partially correct |
67 ms |
1996 KB |
Partially correct - number of queries: 9008 |
8 |
Partially correct |
54 ms |
1880 KB |
Partially correct - number of queries: 9008 |
9 |
Partially correct |
50 ms |
1880 KB |
Partially correct - number of queries: 9009 |
10 |
Partially correct |
76 ms |
1880 KB |
Partially correct - number of queries: 9110 |
11 |
Incorrect |
62 ms |
1988 KB |
Incorrect |
12 |
Halted |
0 ms |
0 KB |
- |