| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 1075919 | mdn2002 | The Big Prize (IOI17_prize) | C++14 | 46 ms | 1556 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<bits/stdc++.h>
using namespace std;
map<int, vector<int>> mp;
vector<int> askk (int x) {
    if (mp.count(x) == 0) return mp[x] = ask(x);
    return mp[x];
}
int find_best(int n) {
	int mx = 0, lim = 500;
	for (int i = 0; i < min(n, lim); i ++) {
        vector<int> a = askk(i);
        mx = max(mx, a[0] + a[1]);
        if (a[0] + a[1] == 0) return i;
	}
	int xxx = 500;
	for (int i = 0; i < n; i ++) {
        vector<int> a = askk(i);
        if (a[0] + a[1] == mx) {
            if (i + xxx < n) {
                vector<int> c = askk(i + xxx);
                if (a[1] == c[1]) {
                    i += xxx;
                    continue;
                }
            }
            int l = 0, r = xxx;
            while (l < r) {
                int mid = (l + r) / 2;
                if (i + mid >= n) r = mid;
                else {
                    vector<int> b = askk(i + mid);
                    if (a[1] == b[1]) l = mid + 1;
                    else r = mid;
                }
            }
            i += l - 1;
        }
        else if (a[0] + a[1] == 0) return i;
	}
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
