| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 789185 | enerelt14 | 커다란 상품 (IOI17_prize) | C++14 | 92 ms | 344 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 "prize.h"
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <vector>
using namespace std;
#define pb push_back
const int B = 472;
int val;
vector<int> find(int l, int r){
	vector<int> ans;
	if (l > r)return ans;
	vector<int> x = ask(r);
	if (x[0] + x[1] != val){
		ans = find(l, r - 1);
		ans.pb(r);
		return ans;
	}
	int tl = l, tr = r;
	while (tl != tr){
		int mid = (tl + tr) / 2;
		vector<int> y = ask(mid);
		if (y[0] + y[1] != val){
			tl = mid + 1;
			continue;
		}
		if (y[1] != x[1])tl = mid + 1;
		else tr = mid;
	}
	if (l == tr)return ans;
	else{
		ans = find(l, tr - 2);
		ans.pb(tr - 1);
		return ans;
	}
}
int find_best(int n){
	vector<int> non_lolipop, x;
	for (int i = 0; i < B && i < n; i++){
		x = ask(i);
		val = max(val, x[0] + x[1]);
	}
	for (int i = 0; i < n; i += B){
		x = find(i, min(n - 1, i + B - 1));
		for (int i = 0; i < x.size(); i++)non_lolipop.pb(x[i]);
	}
	for (int i = 0; i < non_lolipop.size(); i++){
		x = ask(non_lolipop[i]);
		if (x[0] + x[1] == 0)return non_lolipop[i];
	}
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
