Submission #1072378

# Submission time Handle Problem Language Result Execution time Memory
1072378 2024-08-23T17:44:37 Z Joshua_Andersson The Big Prize (IOI17_prize) C++14
20 / 100
67 ms 2132 KB
#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 = 4000;
	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 21 ms 1880 KB Output is correct
2 Correct 34 ms 1880 KB Output is correct
3 Correct 25 ms 1880 KB Output is correct
4 Correct 21 ms 1880 KB Output is correct
5 Correct 35 ms 1876 KB Output is correct
6 Correct 24 ms 1880 KB Output is correct
7 Correct 28 ms 1880 KB Output is correct
8 Correct 21 ms 2128 KB Output is correct
9 Correct 26 ms 2132 KB Output is correct
10 Correct 36 ms 1880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 2128 KB Output is correct
2 Correct 34 ms 1880 KB Output is correct
3 Correct 28 ms 1880 KB Output is correct
4 Correct 21 ms 1880 KB Output is correct
5 Correct 27 ms 1880 KB Output is correct
6 Correct 23 ms 1880 KB Output is correct
7 Correct 26 ms 1880 KB Output is correct
8 Correct 30 ms 1880 KB Output is correct
9 Correct 33 ms 1880 KB Output is correct
10 Correct 32 ms 1992 KB Output is correct
11 Incorrect 67 ms 1880 KB Incorrect
12 Halted 0 ms 0 KB -