#include<bits/stdc++.h>
#include "prize.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<ll,ll> pl;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define po pop_back
#define pb push_back
#define mk make_pair
#define mt make_tuple
#define lw lower_bound
#define up upper_bound
#define ff first
#define ss second
#define BOOST ios_base::sync_with_stdio(); cin.tie(0); cout.tie(0);
#define MOD 1000000007
#define MAX 1e18
#define MIN -1e18
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define per(i,a,b) for(ll i=b;i>=a;i--)
#define con continue
#define freopen freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define PI 3.14159265358979323846264338327950288419716939937510582097494459230781640628
#define read(x) scanf("%lld",&x);
#define print(x) printf("%lld ",x);
#define endl '\n';
// typedef tree<ll , null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
// template< typename T>
// using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll n,m,ans,mid,mn,mx,cnt,T,sum,h1,h2,e[1234567],b[1234567],c[1234567],d[1<<20],k,i,j,l,r,h,a[1234567],w,x,y,z;
bool used[1234567];
vector<int> v[1234567],vec,vv1,vv2;
string s1,s;
int sz[1234567],par[1234567];
int tr[5234567];
ll dx[4]={-1,1,0,0},dy[4]={0,0,-1,1},c1[123][123];
int find_best(int n) {
int mx=-1e6;
for(int i = 0; i < n; i++){
vector<int> res = ask(i);
if(res[0] + res[1] == 0)
return i;
mx = max(mx , res[0]+res[1]);
if((res[0]+res[1]) < mx)continue;
l = i;
r = n-1;
while(l <= r){
ll mid = (l+r)/2;
vector<int> tmp=ask(mid);
if(tmp == res){
i = mid;
l = mid+1;
}
else
r = mid-1;
}
}
}
Compilation message
prize.cpp: In function 'int find_best(int)':
prize.cpp:64:1: warning: control reaches end of non-void function [-Wreturn-type]
64 | }
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
18 ms |
29312 KB |
Output is correct |
2 |
Correct |
21 ms |
29440 KB |
Output is correct |
3 |
Correct |
18 ms |
29312 KB |
Output is correct |
4 |
Correct |
18 ms |
29384 KB |
Output is correct |
5 |
Correct |
18 ms |
29312 KB |
Output is correct |
6 |
Correct |
18 ms |
29312 KB |
Output is correct |
7 |
Correct |
18 ms |
29312 KB |
Output is correct |
8 |
Correct |
18 ms |
29312 KB |
Output is correct |
9 |
Correct |
18 ms |
29312 KB |
Output is correct |
10 |
Correct |
19 ms |
29312 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
20 ms |
29440 KB |
Output is correct |
2 |
Correct |
20 ms |
29312 KB |
Output is correct |
3 |
Correct |
19 ms |
29312 KB |
Output is correct |
4 |
Correct |
20 ms |
29312 KB |
Output is correct |
5 |
Correct |
18 ms |
29312 KB |
Output is correct |
6 |
Correct |
18 ms |
29312 KB |
Output is correct |
7 |
Correct |
18 ms |
29312 KB |
Output is correct |
8 |
Correct |
18 ms |
29312 KB |
Output is correct |
9 |
Correct |
18 ms |
29312 KB |
Output is correct |
10 |
Correct |
19 ms |
29312 KB |
Output is correct |
11 |
Correct |
20 ms |
29388 KB |
Output is correct |
12 |
Correct |
18 ms |
29312 KB |
Output is correct |
13 |
Correct |
22 ms |
29440 KB |
Output is correct |
14 |
Correct |
22 ms |
29312 KB |
Output is correct |
15 |
Correct |
35 ms |
29312 KB |
Output is correct |
16 |
Partially correct |
96 ms |
29312 KB |
Partially correct - number of queries: 7331 |
17 |
Correct |
21 ms |
29312 KB |
Output is correct |
18 |
Partially correct |
121 ms |
29312 KB |
Partially correct - number of queries: 8613 |
19 |
Correct |
18 ms |
29312 KB |
Output is correct |
20 |
Correct |
42 ms |
29312 KB |
Output is correct |
21 |
Correct |
53 ms |
29312 KB |
Output is correct |
22 |
Correct |
27 ms |
29312 KB |
Output is correct |
23 |
Correct |
18 ms |
29312 KB |
Output is correct |
24 |
Correct |
18 ms |
29312 KB |
Output is correct |
25 |
Correct |
68 ms |
29312 KB |
Output is correct |
26 |
Correct |
64 ms |
29312 KB |
Output is correct |
27 |
Correct |
20 ms |
29312 KB |
Output is correct |
28 |
Partially correct |
104 ms |
29312 KB |
Partially correct - number of queries: 8182 |
29 |
Partially correct |
93 ms |
29312 KB |
Partially correct - number of queries: 6195 |
30 |
Partially correct |
113 ms |
29312 KB |
Partially correct - number of queries: 8536 |
31 |
Correct |
19 ms |
29312 KB |
Output is correct |
32 |
Correct |
26 ms |
29312 KB |
Output is correct |
33 |
Correct |
18 ms |
29312 KB |
Output is correct |
34 |
Correct |
42 ms |
29440 KB |
Output is correct |
35 |
Correct |
20 ms |
29312 KB |
Output is correct |
36 |
Correct |
47 ms |
29312 KB |
Output is correct |
37 |
Correct |
20 ms |
29312 KB |
Output is correct |
38 |
Correct |
18 ms |
29312 KB |
Output is correct |
39 |
Correct |
52 ms |
29312 KB |
Output is correct |
40 |
Partially correct |
76 ms |
29312 KB |
Partially correct - number of queries: 7291 |
41 |
Partially correct |
48 ms |
29312 KB |
Partially correct - number of queries: 5147 |
42 |
Partially correct |
44 ms |
29440 KB |
Partially correct - number of queries: 5147 |
43 |
Correct |
62 ms |
29312 KB |
Output is correct |
44 |
Correct |
56 ms |
29312 KB |
Output is correct |
45 |
Correct |
46 ms |
29312 KB |
Output is correct |
46 |
Correct |
21 ms |
29312 KB |
Output is correct |
47 |
Correct |
51 ms |
29312 KB |
Output is correct |
48 |
Partially correct |
86 ms |
29312 KB |
Partially correct - number of queries: 6361 |
49 |
Correct |
28 ms |
29312 KB |
Output is correct |
50 |
Partially correct |
114 ms |
29312 KB |
Partially correct - number of queries: 8607 |
51 |
Correct |
54 ms |
29312 KB |
Output is correct |
52 |
Correct |
22 ms |
29312 KB |
Output is correct |
53 |
Correct |
20 ms |
29312 KB |
Output is correct |
54 |
Correct |
54 ms |
29312 KB |
Output is correct |
55 |
Correct |
20 ms |
29312 KB |
Output is correct |
56 |
Partially correct |
105 ms |
29312 KB |
Partially correct - number of queries: 8606 |
57 |
Partially correct |
93 ms |
29312 KB |
Partially correct - number of queries: 6274 |
58 |
Partially correct |
82 ms |
29312 KB |
Partially correct - number of queries: 6380 |
59 |
Partially correct |
62 ms |
29312 KB |
Partially correct - number of queries: 5147 |
60 |
Correct |
55 ms |
29312 KB |
Output is correct |
61 |
Correct |
22 ms |
29312 KB |
Output is correct |
62 |
Correct |
18 ms |
29312 KB |
Output is correct |
63 |
Correct |
20 ms |
29344 KB |
Output is correct |
64 |
Correct |
19 ms |
29312 KB |
Output is correct |
65 |
Correct |
21 ms |
29312 KB |
Output is correct |
66 |
Correct |
22 ms |
29312 KB |
Output is correct |
67 |
Correct |
20 ms |
29444 KB |
Output is correct |
68 |
Correct |
18 ms |
29312 KB |
Output is correct |
69 |
Correct |
22 ms |
29312 KB |
Output is correct |
70 |
Correct |
18 ms |
29312 KB |
Output is correct |
71 |
Partially correct |
94 ms |
29312 KB |
Partially correct - number of queries: 8736 |
72 |
Correct |
23 ms |
29312 KB |
Output is correct |
73 |
Partially correct |
90 ms |
29312 KB |
Partially correct - number of queries: 8631 |
74 |
Partially correct |
109 ms |
29312 KB |
Partially correct - number of queries: 8678 |
75 |
Correct |
19 ms |
29312 KB |
Output is correct |
76 |
Partially correct |
76 ms |
29312 KB |
Partially correct - number of queries: 7447 |
77 |
Partially correct |
78 ms |
29312 KB |
Partially correct - number of queries: 8642 |
78 |
Correct |
23 ms |
29312 KB |
Output is correct |
79 |
Correct |
56 ms |
29312 KB |
Output is correct |
80 |
Partially correct |
69 ms |
29312 KB |
Partially correct - number of queries: 8604 |
81 |
Partially correct |
85 ms |
29312 KB |
Partially correct - number of queries: 8608 |
82 |
Partially correct |
100 ms |
29440 KB |
Partially correct - number of queries: 8542 |
83 |
Correct |
20 ms |
29312 KB |
Output is correct |
84 |
Partially correct |
74 ms |
29312 KB |
Partially correct - number of queries: 7039 |
85 |
Partially correct |
86 ms |
29312 KB |
Partially correct - number of queries: 8624 |
86 |
Partially correct |
97 ms |
29312 KB |
Partially correct - number of queries: 8190 |
87 |
Correct |
22 ms |
29380 KB |
Output is correct |
88 |
Partially correct |
96 ms |
29312 KB |
Partially correct - number of queries: 7712 |
89 |
Partially correct |
87 ms |
29312 KB |
Partially correct - number of queries: 8121 |
90 |
Correct |
21 ms |
29312 KB |
Output is correct |
91 |
Correct |
64 ms |
29312 KB |
Output is correct |
92 |
Correct |
19 ms |
29312 KB |
Output is correct |
93 |
Correct |
25 ms |
29312 KB |
Output is correct |
94 |
Correct |
25 ms |
29312 KB |
Output is correct |
95 |
Correct |
21 ms |
29384 KB |
Output is correct |
96 |
Correct |
21 ms |
29312 KB |
Output is correct |
97 |
Correct |
18 ms |
29312 KB |
Output is correct |