Submission #347443

# Submission time Handle Problem Language Result Execution time Memory
347443 2021-01-13T05:06:21 Z milleniumEeee The Big Prize (IOI17_prize) C++17
90 / 100
90 ms 640 KB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
 
int find_best(int n) {
  if (n == 1) {
    return 0;
  }
  int S = sqrt(n);
  if (S * S < n) {
    S++;
  }
  int pos = 0;
  int big = 0;
  for (int i = 0; i <= S * 2; i++) {
    vector <int> res = ask(i);
    if (res[0] == 0 && res[1] == 0) {
      return i;
    }
    big = max(big, res[0] + res[1]);
  }
  pos = S + 1;
  while(1) {
    vector <int> pres = ask(pos);
    if (pres[0] == 0 && pres[1] == 0) {
      return pos;
    }
    if (pres[0] + pres[1] == big) {
      int l = pos, r = n;
      while(r - l > 1) {
        int mid = (l + r) >> 1; 
        vector <int> mres = ask(mid);
        if (pres[0] == mres[0] && pres[1] == mres[1]) {
          l = mid;
        } else {
          r = mid;
        }
      }
      pos = l + 1;
    } else {
      pos++;
    }
  }
}
# Verdict Execution time Memory Grader output
1 Correct 9 ms 364 KB Output is correct
2 Correct 7 ms 364 KB Output is correct
3 Correct 12 ms 384 KB Output is correct
4 Correct 5 ms 492 KB Output is correct
5 Correct 5 ms 492 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 9 ms 364 KB Output is correct
8 Correct 7 ms 364 KB Output is correct
9 Correct 7 ms 364 KB Output is correct
10 Correct 8 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 364 KB Output is correct
2 Correct 10 ms 384 KB Output is correct
3 Correct 8 ms 364 KB Output is correct
4 Correct 8 ms 364 KB Output is correct
5 Correct 5 ms 492 KB Output is correct
6 Correct 1 ms 492 KB Output is correct
7 Correct 7 ms 364 KB Output is correct
8 Correct 7 ms 364 KB Output is correct
9 Correct 5 ms 492 KB Output is correct
10 Correct 9 ms 364 KB Output is correct
11 Correct 11 ms 364 KB Output is correct
12 Correct 9 ms 364 KB Output is correct
13 Correct 9 ms 364 KB Output is correct
14 Correct 6 ms 364 KB Output is correct
15 Correct 12 ms 492 KB Output is correct
16 Partially correct 73 ms 364 KB Partially correct - number of queries: 8211
17 Correct 3 ms 640 KB Output is correct
18 Partially correct 81 ms 364 KB Partially correct - number of queries: 9487
19 Correct 3 ms 492 KB Output is correct
20 Correct 26 ms 364 KB Output is correct
21 Correct 39 ms 364 KB Output is correct
22 Correct 8 ms 492 KB Output is correct
23 Correct 9 ms 364 KB Output is correct
24 Correct 5 ms 492 KB Output is correct
25 Partially correct 53 ms 364 KB Partially correct - number of queries: 5749
26 Partially correct 54 ms 364 KB Partially correct - number of queries: 5667
27 Correct 11 ms 364 KB Output is correct
28 Partially correct 90 ms 364 KB Partially correct - number of queries: 9045
29 Partially correct 67 ms 364 KB Partially correct - number of queries: 7086
30 Partially correct 74 ms 364 KB Partially correct - number of queries: 9428
31 Correct 4 ms 364 KB Output is correct
32 Correct 17 ms 364 KB Output is correct
33 Correct 1 ms 364 KB Output is correct
34 Correct 27 ms 364 KB Output is correct
35 Correct 8 ms 364 KB Output is correct
36 Correct 23 ms 364 KB Output is correct
37 Correct 11 ms 364 KB Output is correct
38 Correct 7 ms 364 KB Output is correct
39 Correct 39 ms 364 KB Output is correct
40 Partially correct 77 ms 364 KB Partially correct - number of queries: 8204
41 Partially correct 30 ms 492 KB Partially correct - number of queries: 6025
42 Partially correct 57 ms 364 KB Partially correct - number of queries: 6025
43 Partially correct 28 ms 492 KB Partially correct - number of queries: 5526
44 Correct 40 ms 364 KB Output is correct
45 Correct 34 ms 364 KB Output is correct
46 Correct 4 ms 364 KB Output is correct
47 Partially correct 43 ms 364 KB Partially correct - number of queries: 5066
48 Partially correct 59 ms 364 KB Partially correct - number of queries: 7243
49 Correct 14 ms 364 KB Output is correct
50 Partially correct 48 ms 492 KB Partially correct - number of queries: 9484
51 Correct 54 ms 364 KB Output is correct
52 Correct 9 ms 364 KB Output is correct
53 Correct 11 ms 364 KB Output is correct
54 Correct 43 ms 364 KB Output is correct
55 Correct 5 ms 368 KB Output is correct
56 Partially correct 52 ms 492 KB Partially correct - number of queries: 9486
57 Partially correct 37 ms 368 KB Partially correct - number of queries: 7166
58 Partially correct 61 ms 492 KB Partially correct - number of queries: 7272
59 Partially correct 56 ms 364 KB Partially correct - number of queries: 6025
60 Partially correct 47 ms 364 KB Partially correct - number of queries: 5658
61 Correct 11 ms 364 KB Output is correct
62 Correct 7 ms 364 KB Output is correct
63 Correct 13 ms 364 KB Output is correct
64 Correct 10 ms 364 KB Output is correct
65 Correct 6 ms 364 KB Output is correct
66 Correct 16 ms 364 KB Output is correct
67 Correct 8 ms 364 KB Output is correct
68 Correct 5 ms 364 KB Output is correct
69 Correct 13 ms 364 KB Output is correct
70 Correct 9 ms 364 KB Output is correct
71 Partially correct 75 ms 364 KB Partially correct - number of queries: 9623
72 Correct 14 ms 364 KB Output is correct
73 Partially correct 83 ms 364 KB Partially correct - number of queries: 9503
74 Partially correct 86 ms 364 KB Partially correct - number of queries: 9556
75 Correct 10 ms 364 KB Output is correct
76 Partially correct 76 ms 364 KB Partially correct - number of queries: 8335
77 Partially correct 85 ms 364 KB Partially correct - number of queries: 9551
78 Correct 13 ms 364 KB Output is correct
79 Correct 41 ms 364 KB Output is correct
80 Partially correct 74 ms 364 KB Partially correct - number of queries: 9524
81 Partially correct 88 ms 364 KB Partially correct - number of queries: 9544
82 Partially correct 49 ms 364 KB Partially correct - number of queries: 9411
83 Correct 10 ms 364 KB Output is correct
84 Partially correct 68 ms 364 KB Partially correct - number of queries: 7903
85 Partially correct 89 ms 364 KB Partially correct - number of queries: 9482
86 Correct 9 ms 364 KB Output is correct
87 Correct 8 ms 364 KB Output is correct
88 Correct 7 ms 364 KB Output is correct
89 Correct 8 ms 364 KB Output is correct
90 Correct 8 ms 364 KB Output is correct
91 Correct 8 ms 364 KB Output is correct
92 Correct 8 ms 364 KB Output is correct
93 Correct 13 ms 364 KB Output is correct
94 Correct 12 ms 364 KB Output is correct
95 Correct 14 ms 364 KB Output is correct
96 Correct 12 ms 364 KB Output is correct
97 Correct 9 ms 364 KB Output is correct