Submission #837401

# Submission time Handle Problem Language Result Execution time Memory
837401 2023-08-25T10:22:04 Z 1075508020060209tc Worm Worries (BOI18_worm) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
//#define int long long
int n;int m;int K;int Q;
map<pair<int,pair<int,int>>,int>mp;
int ask(int x,int y,int z){
if(x==0){return 0;}
if(x==n+1){return 0;}
if(mp[{x,{y,z}}]){return mp[{x,{y,z}}];}
cout<<"? "<<x<<" "<<y<<" "<<z<<endl;
int ret;
cin>>ret;
mp[{x,{y,z}}]=ret;
return ret;
}
void ot(int x,int y,int z){
cout<<"! "<<x<<" "<<y<<" "<<z<<endl;
exit(0);
}

void chk(int x){
int a;int b;int c;
a=ask(x-1,1,1);
b=ask(x,1,1);
c=ask(x+1,1,1);
if(b>=a&&b>=c){
    ot(x,1,1);
}
}

int ok(int pl){
if(ask(pl,1,1)>=ask(pl-1,1,1)){return 0;}
return 1;
}

signed main(){
cin>>n>>m>>K>>Q;
int l=1;int r=n;

int a;int b;int c;int d;
a=ask(1,1,1);
b=ask(2,1,1);
c=ask(n-1,1,1);
d=ask(n,1,1);
if(a>=b){ot(1,1,1);}
if(d>=c){ot(n,1,1);}
int l=2;int r=n;
while(l<r){
    int mi=l+(r-l)/2;
    if(ok(mi)){
        r=mi;
    }else{
        l=mi+1;
    }
}
ot(l,1,1);

}

Compilation message

worm.cpp: In function 'int main()':
worm.cpp:47:5: error: redeclaration of 'int l'
   47 | int l=2;int r=n;
      |     ^
worm.cpp:38:5: note: 'int l' previously declared here
   38 | int l=1;int r=n;
      |     ^
worm.cpp:47:13: error: redeclaration of 'int r'
   47 | int l=2;int r=n;
      |             ^
worm.cpp:38:13: note: 'int r' previously declared here
   38 | int l=1;int r=n;
      |             ^