제출 #146151

#제출 시각아이디문제언어결과실행 시간메모리
146151MvCWorm Worries (BOI18_worm)C++14
10 / 100
2 ms428 KiB
#pragma GCC target("avx2") #pragma GCC optimization("O3") #pragma GCC optimization("unroll-loops") #include<bits/stdc++.h> //#include "boxes.h" #define rc(x) return cout<<x<<endl,0 #define pb push_back #define mkp make_pair #define in insert #define er erase #define fd find #define fr first #define sc second typedef long long ll; typedef long double ld; const ll INF=0x3f3f3f3f3f3f3f3f; const ll llinf=(1LL<<62); const int inf=(1<<30); const int nmax=1e6+50; const int mod=1e9+7; using namespace std; int n,m,k,q,viz[nmax]; int ask(int x) { if(x==0 || x==n+1)return 0; if(viz[x])return viz[x]; cout<<"? "<<x<<" "<<1<<" "<<1<<endl; cin>>viz[x]; return viz[x]; } void ans(int x,int y,int z) { cout<<"! "<<x<<" "<<y<<" "<<z<<endl; exit(0); } void rec(int l,int r) { srand(time(0)); if(l==r)ans(l,1,1); int x,y,mid; ll z; if(q==1) { z=l+rand()%(r-l+1); if(z<1)z=1; if(z>n)z=n; x=ask(z); if(max(x,max(viz[l],viz[r]))==x)ans(x,1,1); if(max(x,max(viz[l],viz[r]))==viz[l])ans(l,1,1); if(max(x,max(viz[l],viz[r]))==viz[r])ans(r,1,1); } mid=(l+r)/2; x=ask(mid),y=ask(mid+1); q-=2; if(x>=y) { rec(l,mid); } else if(x<y) { rec(mid+1,r); } } int main() { //freopen("sol.in","r",stdin); //freopen("sol.out","w",stdout); //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0); cin>>n>>m>>k>>q; rec(1,n); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

worm.cpp:2:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization("O3")
 
worm.cpp:3:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization("unroll-loops")
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...