답안 #102066

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
102066 2019-03-22T01:44:05 Z tim25871014 커다란 상품 (IOI17_prize) C++17
90 / 100
77 ms 512 KB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;

int find_best(int n){

    int loli=0;
    for(int i=0;i<(int)min(500,n);i++){
        vector<int> val=ask(i);
        loli=max(loli,val[0]+val[1]);
    }

    for(int i=0;i<n;i++){
        vector<int> val=ask(i);
        if(val[0]+val[1]==0) return i;
        if(val[0]+val[1]==loli){

            int lb=i,ub=n;
            while(ub-lb>1){
                int mid=ub+lb>>1;
                vector<int> ser=ask(mid);
                if(val[0]==ser[0] && ser[0]+ser[1]==loli)
                    lb=mid;
                else ub=mid;
            }
            i=lb;
        }
    }
}

Compilation message

prize.cpp: In function 'int find_best(int)':
prize.cpp:20:27: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
                 int mid=ub+lb>>1;
                         ~~^~~
prize.cpp:29:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 400 KB Output is correct
2 Correct 4 ms 396 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 7 ms 256 KB Output is correct
6 Correct 4 ms 504 KB Output is correct
7 Correct 4 ms 512 KB Output is correct
8 Correct 4 ms 512 KB Output is correct
9 Correct 8 ms 256 KB Output is correct
10 Correct 6 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 396 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 6 ms 256 KB Output is correct
4 Correct 4 ms 512 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 4 ms 504 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 7 ms 308 KB Output is correct
9 Correct 6 ms 256 KB Output is correct
10 Correct 7 ms 256 KB Output is correct
11 Correct 6 ms 384 KB Output is correct
12 Correct 4 ms 376 KB Output is correct
13 Correct 10 ms 256 KB Output is correct
14 Correct 10 ms 256 KB Output is correct
15 Correct 15 ms 384 KB Output is correct
16 Partially correct 53 ms 384 KB Partially correct - number of queries: 7833
17 Correct 5 ms 256 KB Output is correct
18 Partially correct 77 ms 384 KB Partially correct - number of queries: 9109
19 Correct 4 ms 512 KB Output is correct
20 Correct 20 ms 384 KB Output is correct
21 Correct 26 ms 384 KB Output is correct
22 Correct 6 ms 308 KB Output is correct
23 Correct 4 ms 308 KB Output is correct
24 Correct 5 ms 512 KB Output is correct
25 Partially correct 21 ms 508 KB Partially correct - number of queries: 5372
26 Partially correct 39 ms 256 KB Partially correct - number of queries: 5290
27 Correct 4 ms 376 KB Output is correct
28 Partially correct 32 ms 304 KB Partially correct - number of queries: 8667
29 Partially correct 25 ms 376 KB Partially correct - number of queries: 6707
30 Partially correct 53 ms 376 KB Partially correct - number of queries: 9052
31 Correct 7 ms 396 KB Output is correct
32 Correct 9 ms 256 KB Output is correct
33 Correct 4 ms 256 KB Output is correct
34 Correct 30 ms 256 KB Output is correct
35 Correct 7 ms 384 KB Output is correct
36 Correct 19 ms 384 KB Output is correct
37 Correct 6 ms 384 KB Output is correct
38 Correct 7 ms 384 KB Output is correct
39 Correct 16 ms 384 KB Output is correct
40 Partially correct 57 ms 256 KB Partially correct - number of queries: 7806
41 Partially correct 35 ms 256 KB Partially correct - number of queries: 5649
42 Partially correct 23 ms 432 KB Partially correct - number of queries: 5649
43 Partially correct 19 ms 512 KB Partially correct - number of queries: 5148
44 Correct 32 ms 384 KB Output is correct
45 Correct 13 ms 308 KB Output is correct
46 Correct 7 ms 256 KB Output is correct
47 Correct 23 ms 512 KB Output is correct
48 Partially correct 50 ms 256 KB Partially correct - number of queries: 6865
49 Correct 7 ms 376 KB Output is correct
50 Partially correct 72 ms 392 KB Partially correct - number of queries: 9106
51 Correct 14 ms 384 KB Output is correct
52 Correct 5 ms 384 KB Output is correct
53 Correct 9 ms 256 KB Output is correct
54 Correct 40 ms 256 KB Output is correct
55 Correct 4 ms 376 KB Output is correct
56 Partially correct 59 ms 256 KB Partially correct - number of queries: 9108
57 Partially correct 50 ms 392 KB Partially correct - number of queries: 6788
58 Partially correct 45 ms 256 KB Partially correct - number of queries: 6895
59 Partially correct 22 ms 384 KB Partially correct - number of queries: 5649
60 Partially correct 22 ms 404 KB Partially correct - number of queries: 5280
61 Correct 4 ms 384 KB Output is correct
62 Correct 5 ms 512 KB Output is correct
63 Correct 4 ms 376 KB Output is correct
64 Correct 4 ms 396 KB Output is correct
65 Correct 8 ms 256 KB Output is correct
66 Correct 11 ms 384 KB Output is correct
67 Correct 4 ms 384 KB Output is correct
68 Correct 10 ms 384 KB Output is correct
69 Correct 7 ms 400 KB Output is correct
70 Correct 5 ms 376 KB Output is correct
71 Partially correct 74 ms 256 KB Partially correct - number of queries: 9229
72 Correct 11 ms 256 KB Output is correct
73 Partially correct 62 ms 384 KB Partially correct - number of queries: 9123
74 Partially correct 58 ms 396 KB Partially correct - number of queries: 9165
75 Correct 9 ms 256 KB Output is correct
76 Partially correct 50 ms 412 KB Partially correct - number of queries: 7948
77 Partially correct 72 ms 256 KB Partially correct - number of queries: 9116
78 Correct 11 ms 256 KB Output is correct
79 Correct 39 ms 256 KB Output is correct
80 Partially correct 61 ms 256 KB Partially correct - number of queries: 9111
81 Partially correct 59 ms 512 KB Partially correct - number of queries: 9113
82 Partially correct 69 ms 256 KB Partially correct - number of queries: 9047
83 Correct 8 ms 256 KB Output is correct
84 Partially correct 53 ms 256 KB Partially correct - number of queries: 7559
85 Partially correct 62 ms 256 KB Partially correct - number of queries: 9147
86 Correct 10 ms 256 KB Output is correct
87 Correct 4 ms 384 KB Output is correct
88 Correct 6 ms 384 KB Output is correct
89 Correct 9 ms 384 KB Output is correct
90 Correct 7 ms 256 KB Output is correct
91 Correct 8 ms 384 KB Output is correct
92 Correct 10 ms 256 KB Output is correct
93 Correct 12 ms 256 KB Output is correct
94 Correct 13 ms 256 KB Output is correct
95 Correct 10 ms 256 KB Output is correct
96 Correct 11 ms 384 KB Output is correct
97 Correct 9 ms 256 KB Output is correct