Submission #1075762

# Submission time Handle Problem Language Result Execution time Memory
1075762 2024-08-26T09:04:11 Z mdn2002 The Big Prize (IOI17_prize) C++17
20 / 100
45 ms 596 KB
#include "prize.h"
#include<bits/stdc++.h>
using namespace std;

int find_best(int n) {
	int mx = 0, lim = 500;
	for (int i = 0; i < min(n, lim); i ++) {
        vector<int> a = ask(i);
        mx = max(mx, a[0] + a[1]);
        if (a[0] + a[1] == 0) return i;
	}

	for (int i = 0; i < n; i ++) {
        vector<int> a = ask(i);
        if (a[0] + a[1] == mx) {
            for (int j = lim; j >= 1; j /= 2) {
                if (i + j >= n) continue;
                vector<int> b = ask(i + j);
                if (a[1] == b[1]) i += j;
            }
        }
        else if (a[0] + a[1] == 0) return i;
	}
}

Compilation message

prize.cpp: In function 'int find_best(int)':
prize.cpp:24:1: warning: control reaches end of non-void function [-Wreturn-type]
   24 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 8 ms 344 KB Output is correct
3 Correct 8 ms 344 KB Output is correct
4 Correct 16 ms 344 KB Output is correct
5 Correct 10 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 6 ms 344 KB Output is correct
8 Correct 7 ms 344 KB Output is correct
9 Correct 7 ms 344 KB Output is correct
10 Correct 12 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 9 ms 344 KB Output is correct
3 Correct 7 ms 344 KB Output is correct
4 Correct 12 ms 344 KB Output is correct
5 Correct 7 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 6 ms 344 KB Output is correct
8 Correct 7 ms 340 KB Output is correct
9 Correct 7 ms 344 KB Output is correct
10 Correct 10 ms 344 KB Output is correct
11 Correct 4 ms 344 KB Output is correct
12 Correct 3 ms 344 KB Output is correct
13 Correct 12 ms 344 KB Output is correct
14 Correct 5 ms 344 KB Output is correct
15 Correct 6 ms 344 KB Output is correct
16 Partially correct 44 ms 344 KB Partially correct - number of queries: 9181
17 Correct 4 ms 344 KB Output is correct
18 Incorrect 45 ms 596 KB Incorrect
19 Halted 0 ms 0 KB -