# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
52154 |
2018-06-24T11:04:18 Z |
김세빈(#1331) |
커다란 상품 (IOI17_prize) |
C++11 |
|
79 ms |
7352 KB |
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
bool chk[202020];
vector <int> M[202020];
vector <int> myask(int idx)
{
if(chk[idx]) return M[idx];
chk[idx] = 1;
return M[idx] = ask(idx);
}
void find(int m, vector <int>& ret, vector <int>& cands, int s, int e, int l, int r)
{
if(s > e || l > r) return;
int mid = (l+r) >> 1;
int i,j;
vector <int> res = myask(cands[mid]);
if(res[0] + res[1] == m){
find(m, ret, cands, s, res[0] - 1, l, mid-1);
find(m, ret, cands, res[0], e, mid+1, r);
}
else{
for(i=mid+1;i<=r;i++){
res = myask(cands[i]);
if(res[0] + res[1] == m) break;
}
if(i <= r){
for(j=mid;j<i;j++){
ret[res[0] - (i-j)] = cands[j];
}
find(m, ret, cands, s, res[0] - (i-mid) - 1, l, mid-1);
find(m, ret, cands, res[0], e, i+1, r);
}
else{
for(i=mid-1;i>=l;i--){
res = myask(cands[i]);
if(res[0] + res[1] == m) break;
}
for(j=r;j>i;j--) ret[e - (r-j)] = cands[j];
find(m, ret, cands, s, e - (r-i), l, i-1);
}
}
}
int run(vector <int> cands)
{
if(cands.size() == 1) return cands[0];
int i, k = min((int)cands.size(), (int)(sqrt(cands.size()) * 1.5));
int m = 0;
vector <int> res;
for(i=0;i<k;i++){
res = myask(cands[i]);
m = max(m, res[0] + res[1]);
}
vector <int> ret(m);
find(m, ret, cands, 0, m-1, 0, cands.size()-1);
return run(ret);
}
int find_best(int n)
{
vector <int> V;
int i;
for(i=0;i<n;i++){
V.push_back(i);
}
return run(V);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
6760 KB |
Output is correct |
2 |
Correct |
10 ms |
6900 KB |
Output is correct |
3 |
Correct |
14 ms |
6912 KB |
Output is correct |
4 |
Correct |
11 ms |
6912 KB |
Output is correct |
5 |
Correct |
14 ms |
6976 KB |
Output is correct |
6 |
Correct |
14 ms |
6976 KB |
Output is correct |
7 |
Correct |
12 ms |
6976 KB |
Output is correct |
8 |
Correct |
12 ms |
6992 KB |
Output is correct |
9 |
Correct |
14 ms |
7060 KB |
Output is correct |
10 |
Correct |
12 ms |
7060 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
7060 KB |
Output is correct |
2 |
Correct |
20 ms |
7060 KB |
Output is correct |
3 |
Correct |
10 ms |
7060 KB |
Output is correct |
4 |
Correct |
15 ms |
7060 KB |
Output is correct |
5 |
Correct |
15 ms |
7060 KB |
Output is correct |
6 |
Correct |
21 ms |
7060 KB |
Output is correct |
7 |
Correct |
13 ms |
7060 KB |
Output is correct |
8 |
Correct |
21 ms |
7060 KB |
Output is correct |
9 |
Correct |
13 ms |
7060 KB |
Output is correct |
10 |
Correct |
10 ms |
7088 KB |
Output is correct |
11 |
Correct |
18 ms |
7212 KB |
Output is correct |
12 |
Correct |
12 ms |
7212 KB |
Output is correct |
13 |
Correct |
19 ms |
7212 KB |
Output is correct |
14 |
Correct |
15 ms |
7212 KB |
Output is correct |
15 |
Correct |
26 ms |
7232 KB |
Output is correct |
16 |
Partially correct |
49 ms |
7232 KB |
Partially correct - number of queries: 5150 |
17 |
Partially correct |
50 ms |
7232 KB |
Partially correct - number of queries: 5115 |
18 |
Partially correct |
52 ms |
7272 KB |
Partially correct - number of queries: 5130 |
19 |
Correct |
26 ms |
7272 KB |
Output is correct |
20 |
Correct |
28 ms |
7272 KB |
Output is correct |
21 |
Partially correct |
51 ms |
7272 KB |
Partially correct - number of queries: 5113 |
22 |
Correct |
37 ms |
7272 KB |
Output is correct |
23 |
Correct |
11 ms |
7272 KB |
Output is correct |
24 |
Correct |
19 ms |
7272 KB |
Output is correct |
25 |
Correct |
46 ms |
7272 KB |
Output is correct |
26 |
Correct |
49 ms |
7272 KB |
Output is correct |
27 |
Correct |
16 ms |
7272 KB |
Output is correct |
28 |
Correct |
43 ms |
7272 KB |
Output is correct |
29 |
Correct |
39 ms |
7272 KB |
Output is correct |
30 |
Partially correct |
52 ms |
7272 KB |
Partially correct - number of queries: 5094 |
31 |
Partially correct |
49 ms |
7272 KB |
Partially correct - number of queries: 5099 |
32 |
Correct |
17 ms |
7272 KB |
Output is correct |
33 |
Correct |
6 ms |
7272 KB |
Output is correct |
34 |
Partially correct |
35 ms |
7276 KB |
Partially correct - number of queries: 5148 |
35 |
Correct |
16 ms |
7276 KB |
Output is correct |
36 |
Partially correct |
47 ms |
7276 KB |
Partially correct - number of queries: 5061 |
37 |
Correct |
18 ms |
7276 KB |
Output is correct |
38 |
Correct |
15 ms |
7276 KB |
Output is correct |
39 |
Partially correct |
50 ms |
7276 KB |
Partially correct - number of queries: 5052 |
40 |
Correct |
36 ms |
7316 KB |
Output is correct |
41 |
Partially correct |
52 ms |
7316 KB |
Partially correct - number of queries: 5097 |
42 |
Partially correct |
56 ms |
7316 KB |
Partially correct - number of queries: 5097 |
43 |
Partially correct |
50 ms |
7316 KB |
Partially correct - number of queries: 5015 |
44 |
Partially correct |
47 ms |
7316 KB |
Partially correct - number of queries: 5141 |
45 |
Correct |
46 ms |
7316 KB |
Output is correct |
46 |
Partially correct |
49 ms |
7316 KB |
Partially correct - number of queries: 5126 |
47 |
Correct |
51 ms |
7316 KB |
Output is correct |
48 |
Partially correct |
58 ms |
7316 KB |
Partially correct - number of queries: 5110 |
49 |
Partially correct |
42 ms |
7316 KB |
Partially correct - number of queries: 5101 |
50 |
Partially correct |
53 ms |
7316 KB |
Partially correct - number of queries: 5124 |
51 |
Partially correct |
37 ms |
7316 KB |
Partially correct - number of queries: 5114 |
52 |
Partially correct |
51 ms |
7316 KB |
Partially correct - number of queries: 5128 |
53 |
Correct |
16 ms |
7316 KB |
Output is correct |
54 |
Partially correct |
51 ms |
7316 KB |
Partially correct - number of queries: 5114 |
55 |
Partially correct |
50 ms |
7316 KB |
Partially correct - number of queries: 5125 |
56 |
Partially correct |
26 ms |
7316 KB |
Partially correct - number of queries: 5135 |
57 |
Partially correct |
27 ms |
7316 KB |
Partially correct - number of queries: 5100 |
58 |
Partially correct |
58 ms |
7316 KB |
Partially correct - number of queries: 5106 |
59 |
Partially correct |
47 ms |
7316 KB |
Partially correct - number of queries: 5101 |
60 |
Partially correct |
28 ms |
7316 KB |
Partially correct - number of queries: 5086 |
61 |
Correct |
14 ms |
7316 KB |
Output is correct |
62 |
Correct |
14 ms |
7316 KB |
Output is correct |
63 |
Correct |
16 ms |
7316 KB |
Output is correct |
64 |
Correct |
15 ms |
7316 KB |
Output is correct |
65 |
Correct |
14 ms |
7316 KB |
Output is correct |
66 |
Correct |
18 ms |
7316 KB |
Output is correct |
67 |
Correct |
12 ms |
7316 KB |
Output is correct |
68 |
Correct |
16 ms |
7316 KB |
Output is correct |
69 |
Correct |
19 ms |
7316 KB |
Output is correct |
70 |
Correct |
16 ms |
7316 KB |
Output is correct |
71 |
Partially correct |
79 ms |
7316 KB |
Partially correct - number of queries: 5428 |
72 |
Correct |
13 ms |
7316 KB |
Output is correct |
73 |
Partially correct |
42 ms |
7352 KB |
Partially correct - number of queries: 5365 |
74 |
Partially correct |
48 ms |
7352 KB |
Partially correct - number of queries: 5392 |
75 |
Correct |
14 ms |
7352 KB |
Output is correct |
76 |
Correct |
38 ms |
7352 KB |
Output is correct |
77 |
Partially correct |
46 ms |
7352 KB |
Partially correct - number of queries: 5122 |
78 |
Correct |
15 ms |
7352 KB |
Output is correct |
79 |
Correct |
29 ms |
7352 KB |
Output is correct |
80 |
Partially correct |
49 ms |
7352 KB |
Partially correct - number of queries: 5130 |
81 |
Partially correct |
55 ms |
7352 KB |
Partially correct - number of queries: 5111 |
82 |
Partially correct |
43 ms |
7352 KB |
Partially correct - number of queries: 5058 |
83 |
Correct |
14 ms |
7352 KB |
Output is correct |
84 |
Correct |
40 ms |
7352 KB |
Output is correct |
85 |
Partially correct |
41 ms |
7352 KB |
Partially correct - number of queries: 5095 |
86 |
Correct |
14 ms |
7352 KB |
Output is correct |
87 |
Correct |
13 ms |
7352 KB |
Output is correct |
88 |
Correct |
14 ms |
7352 KB |
Output is correct |
89 |
Correct |
13 ms |
7352 KB |
Output is correct |
90 |
Correct |
12 ms |
7352 KB |
Output is correct |
91 |
Correct |
13 ms |
7352 KB |
Output is correct |
92 |
Correct |
12 ms |
7352 KB |
Output is correct |
93 |
Correct |
15 ms |
7352 KB |
Output is correct |
94 |
Correct |
16 ms |
7352 KB |
Output is correct |
95 |
Correct |
13 ms |
7352 KB |
Output is correct |
96 |
Correct |
15 ms |
7352 KB |
Output is correct |
97 |
Correct |
13 ms |
7352 KB |
Output is correct |