답안 #1060906

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1060906 2024-08-16T04:24:49 Z onbert 커다란 상품 (IOI17_prize) C++17
90 / 100
63 ms 11604 KB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5;
vector<int> vals[maxn];
vector<int> qry(int i) {
    if (vals[i][0]!=-1) return vals[i];
    else return vals[i] = ask(i);
}
int find_best(int n) {
    for (int i=0;i<n;i++) vals[i] = {-1, -1};
    int mx = 0;
    for (int i=0;i<n;i++) {
        vector<int> x = qry(i);
        mx = max(x[0]+x[1], mx);
        if (x[0] + x[1] == 0) return i;
        int l = i, r = n-1;
        while (l<r && x[0]+x[1] == mx) {
            int mid = (l+r+1)/2;
            vector<int> y = qry(mid);
            mx = max(y[0]+y[1], mx);
            if (y[0]+y[1]==0) return mid;
            if (y[0]!=x[0] || y[1]!=x[1]) r = mid-1;
            else l = mid;
        }
        i = l;
    }
}

Compilation message

prize.cpp: In function 'int find_best(int)':
prize.cpp:28:1: warning: control reaches end of non-void function [-Wreturn-type]
   28 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 11352 KB Output is correct
2 Correct 8 ms 11352 KB Output is correct
3 Correct 8 ms 11352 KB Output is correct
4 Correct 7 ms 11352 KB Output is correct
5 Correct 7 ms 11352 KB Output is correct
6 Correct 7 ms 11352 KB Output is correct
7 Correct 7 ms 11352 KB Output is correct
8 Correct 9 ms 11352 KB Output is correct
9 Correct 7 ms 11352 KB Output is correct
10 Correct 7 ms 11604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 11352 KB Output is correct
2 Correct 8 ms 11352 KB Output is correct
3 Correct 9 ms 11352 KB Output is correct
4 Correct 8 ms 11352 KB Output is correct
5 Correct 8 ms 11352 KB Output is correct
6 Correct 8 ms 11352 KB Output is correct
7 Correct 8 ms 11352 KB Output is correct
8 Correct 7 ms 11352 KB Output is correct
9 Correct 11 ms 11352 KB Output is correct
10 Correct 7 ms 11352 KB Output is correct
11 Correct 7 ms 11352 KB Output is correct
12 Correct 8 ms 11348 KB Output is correct
13 Correct 9 ms 11352 KB Output is correct
14 Correct 5 ms 5720 KB Output is correct
15 Correct 13 ms 11352 KB Output is correct
16 Partially correct 42 ms 11352 KB Partially correct - number of queries: 6747
17 Correct 8 ms 11392 KB Output is correct
18 Partially correct 51 ms 11352 KB Partially correct - number of queries: 7887
19 Correct 9 ms 11352 KB Output is correct
20 Correct 18 ms 8024 KB Output is correct
21 Correct 21 ms 11352 KB Output is correct
22 Correct 9 ms 11352 KB Output is correct
23 Correct 9 ms 11352 KB Output is correct
24 Correct 8 ms 11352 KB Output is correct
25 Correct 30 ms 11352 KB Output is correct
26 Correct 37 ms 11368 KB Output is correct
27 Correct 8 ms 11352 KB Output is correct
28 Partially correct 50 ms 11352 KB Partially correct - number of queries: 7428
29 Partially correct 45 ms 11352 KB Partially correct - number of queries: 5636
30 Partially correct 52 ms 11352 KB Partially correct - number of queries: 7844
31 Correct 8 ms 11352 KB Output is correct
32 Correct 9 ms 11352 KB Output is correct
33 Correct 1 ms 4952 KB Output is correct
34 Correct 24 ms 11352 KB Output is correct
35 Correct 8 ms 11352 KB Output is correct
36 Correct 14 ms 11352 KB Output is correct
37 Correct 11 ms 11352 KB Output is correct
38 Correct 7 ms 11352 KB Output is correct
39 Correct 20 ms 11352 KB Output is correct
40 Partially correct 48 ms 11352 KB Partially correct - number of queries: 6730
41 Correct 38 ms 11352 KB Output is correct
42 Correct 23 ms 11352 KB Output is correct
43 Correct 22 ms 11352 KB Output is correct
44 Correct 22 ms 11352 KB Output is correct
45 Correct 15 ms 11352 KB Output is correct
46 Correct 8 ms 11352 KB Output is correct
47 Correct 20 ms 11352 KB Output is correct
48 Partially correct 33 ms 11352 KB Partially correct - number of queries: 5851
49 Correct 10 ms 11352 KB Output is correct
50 Partially correct 49 ms 11352 KB Partially correct - number of queries: 7890
51 Correct 20 ms 11352 KB Output is correct
52 Correct 8 ms 11352 KB Output is correct
53 Correct 8 ms 11192 KB Output is correct
54 Correct 24 ms 11352 KB Output is correct
55 Correct 7 ms 11352 KB Output is correct
56 Partially correct 55 ms 11352 KB Partially correct - number of queries: 7890
57 Partially correct 35 ms 11352 KB Partially correct - number of queries: 5767
58 Partially correct 41 ms 11352 KB Partially correct - number of queries: 5839
59 Correct 24 ms 11352 KB Output is correct
60 Correct 31 ms 11352 KB Output is correct
61 Correct 8 ms 11352 KB Output is correct
62 Correct 7 ms 11352 KB Output is correct
63 Correct 10 ms 11352 KB Output is correct
64 Correct 7 ms 11352 KB Output is correct
65 Correct 9 ms 11352 KB Output is correct
66 Correct 10 ms 11352 KB Output is correct
67 Correct 8 ms 11352 KB Output is correct
68 Correct 10 ms 11352 KB Output is correct
69 Correct 10 ms 11352 KB Output is correct
70 Correct 7 ms 11352 KB Output is correct
71 Partially correct 47 ms 11352 KB Partially correct - number of queries: 7757
72 Correct 10 ms 11352 KB Output is correct
73 Partially correct 63 ms 11352 KB Partially correct - number of queries: 7648
74 Partially correct 50 ms 11352 KB Partially correct - number of queries: 7690
75 Correct 8 ms 11352 KB Output is correct
76 Partially correct 38 ms 11352 KB Partially correct - number of queries: 6628
77 Partially correct 49 ms 11352 KB Partially correct - number of queries: 7919
78 Correct 10 ms 11352 KB Output is correct
79 Correct 25 ms 11348 KB Output is correct
80 Partially correct 35 ms 11352 KB Partially correct - number of queries: 7911
81 Partially correct 38 ms 11352 KB Partially correct - number of queries: 7936
82 Partially correct 46 ms 11352 KB Partially correct - number of queries: 7882
83 Correct 9 ms 11352 KB Output is correct
84 Partially correct 41 ms 11352 KB Partially correct - number of queries: 6461
85 Partially correct 58 ms 11352 KB Partially correct - number of queries: 7913
86 Partially correct 35 ms 11352 KB Partially correct - number of queries: 6036
87 Correct 9 ms 11348 KB Output is correct
88 Partially correct 48 ms 11352 KB Partially correct - number of queries: 5702
89 Partially correct 40 ms 11352 KB Partially correct - number of queries: 5973
90 Correct 8 ms 11352 KB Output is correct
91 Correct 24 ms 11352 KB Output is correct
92 Correct 8 ms 11352 KB Output is correct
93 Correct 9 ms 11352 KB Output is correct
94 Correct 9 ms 11352 KB Output is correct
95 Correct 10 ms 11352 KB Output is correct
96 Correct 13 ms 11352 KB Output is correct
97 Correct 7 ms 11352 KB Output is correct