답안 #294729

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
294729 2020-09-09T08:52:39 Z ASDF123 커다란 상품 (IOI17_prize) C++14
90 / 100
94 ms 384 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++;
    }
  }
}

//#include <bits/stdc++.h>
//using namespace std;

//signed main() { 
  //cout << log2(200000) << endl;
  
  //int cnt = 190000;
  //while (cnt > 1) {
    //cout << cnt << endl;
    //cnt = sqrt(cnt);
  //}
  //double ans = 190000 * sqrt(190000) 
//}
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 256 KB Output is correct
2 Correct 8 ms 256 KB Output is correct
3 Correct 9 ms 256 KB Output is correct
4 Correct 10 ms 256 KB Output is correct
5 Correct 8 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 9 ms 256 KB Output is correct
8 Correct 9 ms 256 KB Output is correct
9 Correct 7 ms 256 KB Output is correct
10 Correct 5 ms 288 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 256 KB Output is correct
2 Correct 7 ms 256 KB Output is correct
3 Correct 6 ms 256 KB Output is correct
4 Correct 8 ms 256 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 8 ms 256 KB Output is correct
8 Correct 7 ms 384 KB Output is correct
9 Correct 9 ms 288 KB Output is correct
10 Correct 7 ms 256 KB Output is correct
11 Correct 12 ms 256 KB Output is correct
12 Correct 9 ms 256 KB Output is correct
13 Correct 13 ms 256 KB Output is correct
14 Correct 6 ms 288 KB Output is correct
15 Correct 18 ms 256 KB Output is correct
16 Partially correct 69 ms 256 KB Partially correct - number of queries: 8211
17 Correct 5 ms 256 KB Output is correct
18 Partially correct 74 ms 256 KB Partially correct - number of queries: 9487
19 Correct 4 ms 256 KB Output is correct
20 Correct 21 ms 256 KB Output is correct
21 Correct 51 ms 256 KB Output is correct
22 Correct 15 ms 256 KB Output is correct
23 Correct 9 ms 256 KB Output is correct
24 Correct 9 ms 256 KB Output is correct
25 Partially correct 29 ms 376 KB Partially correct - number of queries: 5749
26 Partially correct 51 ms 256 KB Partially correct - number of queries: 5667
27 Correct 11 ms 256 KB Output is correct
28 Partially correct 83 ms 256 KB Partially correct - number of queries: 9045
29 Partially correct 67 ms 256 KB Partially correct - number of queries: 7086
30 Partially correct 94 ms 256 KB Partially correct - number of queries: 9428
31 Correct 5 ms 256 KB Output is correct
32 Correct 14 ms 256 KB Output is correct
33 Correct 0 ms 256 KB Output is correct
34 Correct 35 ms 256 KB Output is correct
35 Correct 12 ms 256 KB Output is correct
36 Correct 26 ms 256 KB Output is correct
37 Correct 8 ms 356 KB Output is correct
38 Correct 9 ms 256 KB Output is correct
39 Correct 34 ms 288 KB Output is correct
40 Partially correct 55 ms 256 KB Partially correct - number of queries: 8204
41 Partially correct 50 ms 256 KB Partially correct - number of queries: 6025
42 Partially correct 55 ms 256 KB Partially correct - number of queries: 6025
43 Partially correct 49 ms 256 KB Partially correct - number of queries: 5526
44 Correct 35 ms 256 KB Output is correct
45 Correct 36 ms 256 KB Output is correct
46 Correct 3 ms 256 KB Output is correct
47 Partially correct 47 ms 256 KB Partially correct - number of queries: 5066
48 Partially correct 59 ms 256 KB Partially correct - number of queries: 7243
49 Correct 15 ms 256 KB Output is correct
50 Partially correct 94 ms 256 KB Partially correct - number of queries: 9484
51 Correct 24 ms 376 KB Output is correct
52 Correct 5 ms 376 KB Output is correct
53 Correct 6 ms 360 KB Output is correct
54 Correct 43 ms 256 KB Output is correct
55 Correct 3 ms 256 KB Output is correct
56 Partially correct 88 ms 256 KB Partially correct - number of queries: 9486
57 Partially correct 67 ms 256 KB Partially correct - number of queries: 7166
58 Partially correct 56 ms 256 KB Partially correct - number of queries: 7272
59 Partially correct 44 ms 376 KB Partially correct - number of queries: 6025
60 Partially correct 53 ms 256 KB Partially correct - number of queries: 5658
61 Correct 10 ms 256 KB Output is correct
62 Correct 9 ms 384 KB Output is correct
63 Correct 10 ms 256 KB Output is correct
64 Correct 5 ms 376 KB Output is correct
65 Correct 9 ms 256 KB Output is correct
66 Correct 13 ms 256 KB Output is correct
67 Correct 11 ms 384 KB Output is correct
68 Correct 5 ms 256 KB Output is correct
69 Correct 12 ms 256 KB Output is correct
70 Correct 6 ms 256 KB Output is correct
71 Partially correct 89 ms 256 KB Partially correct - number of queries: 9623
72 Correct 14 ms 256 KB Output is correct
73 Partially correct 78 ms 256 KB Partially correct - number of queries: 9503
74 Partially correct 90 ms 256 KB Partially correct - number of queries: 9556
75 Correct 10 ms 256 KB Output is correct
76 Partially correct 73 ms 256 KB Partially correct - number of queries: 8335
77 Partially correct 87 ms 256 KB Partially correct - number of queries: 9551
78 Correct 12 ms 256 KB Output is correct
79 Correct 44 ms 256 KB Output is correct
80 Partially correct 74 ms 256 KB Partially correct - number of queries: 9524
81 Partially correct 80 ms 256 KB Partially correct - number of queries: 9544
82 Partially correct 77 ms 256 KB Partially correct - number of queries: 9411
83 Correct 13 ms 256 KB Output is correct
84 Partially correct 60 ms 256 KB Partially correct - number of queries: 7903
85 Partially correct 66 ms 256 KB Partially correct - number of queries: 9482
86 Correct 10 ms 256 KB Output is correct
87 Correct 6 ms 256 KB Output is correct
88 Correct 6 ms 256 KB Output is correct
89 Correct 10 ms 256 KB Output is correct
90 Correct 7 ms 256 KB Output is correct
91 Correct 7 ms 256 KB Output is correct
92 Correct 10 ms 256 KB Output is correct
93 Correct 13 ms 256 KB Output is correct
94 Correct 14 ms 256 KB Output is correct
95 Correct 14 ms 256 KB Output is correct
96 Correct 12 ms 256 KB Output is correct
97 Correct 9 ms 256 KB Output is correct