답안 #165257

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
165257 2019-11-26T09:02:37 Z Segtree 커다란 상품 (IOI17_prize) C++14
90 / 100
119 ms 508 KB
#include<iostream>
#include"prize.h"
using namespace std;
typedef long long ll;

int find_best(int n){
    vector<int> a,b,v;
    int bef=-1;
    int ma=-1;
    for(int i=0;i<min(n,600);i++){
	a=ask(i);
	int t=a[0]+a[1];
	if(t==0)return i;
	if(t>ma){
	    ma=t;
	}
    }//
    for(int i=0;i<min(n,600);i++){
	a=ask(i);
	int t=a[0]+a[1];
	if(t!=ma){
	    bef=i;
	    break;
	}
    }//はじめての上が見つかるorすべてアメ
    
    
    while(1){
	b=ask(bef+1); if(b[0]+b[1]==0)return bef+1;
	if(b[0]+b[1]!=ma){
	    bef=bef+1;
	    continue;
	}
	ll l=bef+1,r=n-1,mid;
	while(l<r-1){
	    mid=(l+r)>>1;
	    a=ask(mid);
	    if(a[0]+a[1]==ma){
		if(a==b)l=mid;
		else r=mid;
	    }
	    else{
		r=mid;
	    }
	}
	bef=r;
	b=ask(r); if(b[0]+b[1]==0)return r;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 248 KB Output is correct
2 Correct 15 ms 380 KB Output is correct
3 Correct 14 ms 376 KB Output is correct
4 Correct 16 ms 248 KB Output is correct
5 Correct 14 ms 376 KB Output is correct
6 Correct 2 ms 248 KB Output is correct
7 Correct 15 ms 248 KB Output is correct
8 Correct 14 ms 392 KB Output is correct
9 Correct 16 ms 248 KB Output is correct
10 Correct 15 ms 248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 248 KB Output is correct
2 Correct 8 ms 392 KB Output is correct
3 Correct 16 ms 376 KB Output is correct
4 Correct 17 ms 248 KB Output is correct
5 Correct 15 ms 248 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 17 ms 248 KB Output is correct
8 Correct 12 ms 376 KB Output is correct
9 Correct 11 ms 252 KB Output is correct
10 Correct 8 ms 396 KB Output is correct
11 Correct 9 ms 308 KB Output is correct
12 Correct 15 ms 304 KB Output is correct
13 Correct 19 ms 248 KB Output is correct
14 Correct 11 ms 252 KB Output is correct
15 Correct 15 ms 376 KB Output is correct
16 Partially correct 81 ms 376 KB Partially correct - number of queries: 8335
17 Correct 7 ms 248 KB Output is correct
18 Partially correct 56 ms 248 KB Partially correct - number of queries: 9613
19 Correct 19 ms 248 KB Output is correct
20 Correct 33 ms 248 KB Output is correct
21 Correct 39 ms 248 KB Output is correct
22 Correct 15 ms 248 KB Output is correct
23 Correct 9 ms 248 KB Output is correct
24 Correct 13 ms 248 KB Output is correct
25 Partially correct 53 ms 508 KB Partially correct - number of queries: 5751
26 Partially correct 42 ms 392 KB Partially correct - number of queries: 5428
27 Correct 9 ms 292 KB Output is correct
28 Partially correct 65 ms 376 KB Partially correct - number of queries: 9024
29 Partially correct 63 ms 312 KB Partially correct - number of queries: 7169
30 Partially correct 81 ms 376 KB Partially correct - number of queries: 9558
31 Correct 8 ms 248 KB Output is correct
32 Correct 10 ms 424 KB Output is correct
33 Correct 2 ms 376 KB Output is correct
34 Correct 19 ms 308 KB Output is correct
35 Correct 9 ms 308 KB Output is correct
36 Correct 32 ms 404 KB Output is correct
37 Correct 19 ms 248 KB Output is correct
38 Correct 8 ms 376 KB Output is correct
39 Partially correct 46 ms 248 KB Partially correct - number of queries: 5001
40 Partially correct 41 ms 392 KB Partially correct - number of queries: 8385
41 Partially correct 48 ms 312 KB Partially correct - number of queries: 6152
42 Partially correct 64 ms 248 KB Partially correct - number of queries: 6152
43 Partially correct 59 ms 248 KB Partially correct - number of queries: 5667
44 Correct 41 ms 376 KB Output is correct
45 Correct 20 ms 420 KB Output is correct
46 Correct 5 ms 248 KB Output is correct
47 Partially correct 55 ms 248 KB Partially correct - number of queries: 5182
48 Partially correct 67 ms 248 KB Partially correct - number of queries: 7369
49 Correct 20 ms 248 KB Output is correct
50 Partially correct 111 ms 376 KB Partially correct - number of queries: 9609
51 Correct 45 ms 248 KB Output is correct
52 Correct 13 ms 248 KB Output is correct
53 Correct 14 ms 248 KB Output is correct
54 Correct 24 ms 388 KB Output is correct
55 Correct 7 ms 248 KB Output is correct
56 Partially correct 61 ms 376 KB Partially correct - number of queries: 9612
57 Partially correct 72 ms 248 KB Partially correct - number of queries: 7292
58 Partially correct 78 ms 376 KB Partially correct - number of queries: 7395
59 Partially correct 58 ms 376 KB Partially correct - number of queries: 6152
60 Partially correct 51 ms 248 KB Partially correct - number of queries: 5787
61 Correct 18 ms 252 KB Output is correct
62 Correct 15 ms 248 KB Output is correct
63 Correct 12 ms 248 KB Output is correct
64 Correct 16 ms 252 KB Output is correct
65 Correct 7 ms 388 KB Output is correct
66 Correct 19 ms 248 KB Output is correct
67 Correct 14 ms 248 KB Output is correct
68 Correct 7 ms 248 KB Output is correct
69 Correct 16 ms 376 KB Output is correct
70 Correct 15 ms 376 KB Output is correct
71 Partially correct 119 ms 248 KB Partially correct - number of queries: 9921
72 Correct 20 ms 248 KB Output is correct
73 Partially correct 79 ms 308 KB Partially correct - number of queries: 9818
74 Partially correct 67 ms 376 KB Partially correct - number of queries: 9861
75 Correct 15 ms 392 KB Output is correct
76 Partially correct 82 ms 248 KB Partially correct - number of queries: 8633
77 Partially correct 93 ms 248 KB Partially correct - number of queries: 9727
78 Correct 10 ms 424 KB Output is correct
79 Partially correct 55 ms 248 KB Partially correct - number of queries: 5045
80 Partially correct 101 ms 248 KB Partially correct - number of queries: 9812
81 Partially correct 92 ms 248 KB Partially correct - number of queries: 9861
82 Partially correct 101 ms 248 KB Partially correct - number of queries: 9182
83 Correct 17 ms 308 KB Output is correct
84 Partially correct 73 ms 308 KB Partially correct - number of queries: 7617
85 Partially correct 72 ms 296 KB Partially correct - number of queries: 9399
86 Correct 14 ms 376 KB Output is correct
87 Correct 10 ms 248 KB Output is correct
88 Correct 13 ms 388 KB Output is correct
89 Correct 16 ms 376 KB Output is correct
90 Correct 9 ms 248 KB Output is correct
91 Correct 13 ms 380 KB Output is correct
92 Correct 12 ms 376 KB Output is correct
93 Correct 19 ms 248 KB Output is correct
94 Correct 12 ms 376 KB Output is correct
95 Correct 19 ms 248 KB Output is correct
96 Correct 16 ms 248 KB Output is correct
97 Correct 11 ms 376 KB Output is correct