답안 #850244

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
850244 2023-09-16T07:57:52 Z 1075508020060209tc Mađioničar (COI22_madionicar) C++14
100 / 100
1384 ms 26728 KB
#include<bits/stdc++.h>
using namespace std;
//#define int long long
map<pair<int,int>,int>mp;
map<pair<int,int>,int>vis;
int cnt=0;
int ask(int l,int r){
if(l==r){return 1;}
if(vis[{l,r}]){return mp[{l,r}];}
cnt++;
if(cnt==200001){
cout<<"! "<<7777777<<endl;
exit(0);
}
cout<<"? "<<l<<" "<<r<<endl;
int ret;
vis[{l,r}]=1;
cin>>ret;
mp[{l,r}]=ret;
return ret;
}
int n;
int rpl[300005];
int rask(int l,int r){
if(l==r){return 1;}
if(l%2==1){l++;}
if(r%2==1){r--;}
if(l==r){return 1;}
l=(l+1)/2;r=(r+1)/2;
return ask(l,r);
}

int par[300005];
//*#a#a#a#b#

signed main(){
cin>>n;

int l=1;int r=1;
int ans=1;
par[1]=1;
for(int i=2;i<=n+n+1-ans;i++){
    int v=ans;
    while( i-v>=1&&i+v<=n+n+1&&rask(i-v,i+v)){
        v++;
    }
    ans=v;
}
cout<<"! "<<ans-1<<endl;


}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:39:5: warning: unused variable 'l' [-Wunused-variable]
   39 | int l=1;int r=1;
      |     ^
Main.cpp:39:13: warning: unused variable 'r' [-Wunused-variable]
   39 | int l=1;int r=1;
      |             ^
# 결과 실행 시간 메모리 Grader output
1 Correct 70 ms 2788 KB Output is correct
2 Correct 88 ms 2776 KB Output is correct
3 Correct 80 ms 2816 KB Output is correct
4 Correct 71 ms 2892 KB Output is correct
5 Correct 116 ms 2928 KB Output is correct
6 Correct 79 ms 2580 KB Output is correct
7 Correct 97 ms 2392 KB Output is correct
8 Correct 63 ms 2808 KB Output is correct
9 Correct 86 ms 2976 KB Output is correct
10 Correct 79 ms 2932 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 70 ms 2788 KB Output is correct
2 Correct 88 ms 2776 KB Output is correct
3 Correct 80 ms 2816 KB Output is correct
4 Correct 71 ms 2892 KB Output is correct
5 Correct 116 ms 2928 KB Output is correct
6 Correct 79 ms 2580 KB Output is correct
7 Correct 97 ms 2392 KB Output is correct
8 Correct 63 ms 2808 KB Output is correct
9 Correct 86 ms 2976 KB Output is correct
10 Correct 79 ms 2932 KB Output is correct
11 Correct 815 ms 17848 KB Output is correct
12 Correct 845 ms 17120 KB Output is correct
13 Correct 769 ms 17500 KB Output is correct
14 Correct 777 ms 17128 KB Output is correct
15 Correct 803 ms 17440 KB Output is correct
16 Correct 827 ms 17768 KB Output is correct
17 Correct 843 ms 17376 KB Output is correct
18 Correct 855 ms 17120 KB Output is correct
19 Correct 907 ms 17272 KB Output is correct
20 Correct 798 ms 17340 KB Output is correct
21 Correct 819 ms 17376 KB Output is correct
22 Correct 750 ms 17552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1289 ms 25832 KB Output is correct
2 Correct 670 ms 13624 KB Output is correct
3 Correct 1280 ms 25916 KB Output is correct
4 Correct 1327 ms 26300 KB Output is correct
5 Correct 1326 ms 25908 KB Output is correct
6 Correct 1278 ms 26296 KB Output is correct
7 Correct 1317 ms 25608 KB Output is correct
8 Correct 1251 ms 26564 KB Output is correct
9 Correct 1252 ms 26284 KB Output is correct
10 Correct 1241 ms 26444 KB Output is correct
11 Correct 1279 ms 25896 KB Output is correct
12 Correct 1328 ms 25916 KB Output is correct
13 Correct 1277 ms 25696 KB Output is correct
14 Correct 1247 ms 26256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 70 ms 2788 KB Output is correct
2 Correct 88 ms 2776 KB Output is correct
3 Correct 80 ms 2816 KB Output is correct
4 Correct 71 ms 2892 KB Output is correct
5 Correct 116 ms 2928 KB Output is correct
6 Correct 79 ms 2580 KB Output is correct
7 Correct 97 ms 2392 KB Output is correct
8 Correct 63 ms 2808 KB Output is correct
9 Correct 86 ms 2976 KB Output is correct
10 Correct 79 ms 2932 KB Output is correct
11 Correct 815 ms 17848 KB Output is correct
12 Correct 845 ms 17120 KB Output is correct
13 Correct 769 ms 17500 KB Output is correct
14 Correct 777 ms 17128 KB Output is correct
15 Correct 803 ms 17440 KB Output is correct
16 Correct 827 ms 17768 KB Output is correct
17 Correct 843 ms 17376 KB Output is correct
18 Correct 855 ms 17120 KB Output is correct
19 Correct 907 ms 17272 KB Output is correct
20 Correct 798 ms 17340 KB Output is correct
21 Correct 819 ms 17376 KB Output is correct
22 Correct 750 ms 17552 KB Output is correct
23 Correct 1289 ms 25832 KB Output is correct
24 Correct 670 ms 13624 KB Output is correct
25 Correct 1280 ms 25916 KB Output is correct
26 Correct 1327 ms 26300 KB Output is correct
27 Correct 1326 ms 25908 KB Output is correct
28 Correct 1278 ms 26296 KB Output is correct
29 Correct 1317 ms 25608 KB Output is correct
30 Correct 1251 ms 26564 KB Output is correct
31 Correct 1252 ms 26284 KB Output is correct
32 Correct 1241 ms 26444 KB Output is correct
33 Correct 1279 ms 25896 KB Output is correct
34 Correct 1328 ms 25916 KB Output is correct
35 Correct 1277 ms 25696 KB Output is correct
36 Correct 1247 ms 26256 KB Output is correct
37 Correct 1280 ms 26408 KB Output is correct
38 Correct 1256 ms 26124 KB Output is correct
39 Correct 1315 ms 26728 KB Output is correct
40 Correct 1258 ms 25912 KB Output is correct
41 Correct 1283 ms 25968 KB Output is correct
42 Correct 1302 ms 26184 KB Output is correct
43 Correct 1384 ms 26396 KB Output is correct
44 Correct 1208 ms 26156 KB Output is correct
45 Correct 1241 ms 26152 KB Output is correct
46 Correct 1230 ms 26316 KB Output is correct
47 Correct 1270 ms 25712 KB Output is correct
48 Correct 1306 ms 26204 KB Output is correct
49 Correct 1245 ms 25696 KB Output is correct
50 Correct 952 ms 20312 KB Output is correct
51 Correct 1340 ms 26080 KB Output is correct
52 Correct 1248 ms 26312 KB Output is correct