제출 #103093

#제출 시각아이디문제언어결과실행 시간메모리
103093username커다란 상품 (IOI17_prize)C++14
0 / 100
93 ms936 KiB
#include<bits/stdc++.h> #include "prize.h" using namespace std; typedef pair<int,int> pii; typedef vector<int> VI; #define REP(i,j,k) for(register int i=(j);i<(k);++i) #define RREP(i,j,k) for(register int i=(j)-1;i>=(k);--i) #define ALL(a) a.begin(),a.end() #define MST(a,v) memset(a,(v),sizeof a) #define pb push_back #define mid (l+r>>1) #define lch (idx*2+1) #define rch (idx*2+2) #define F first #define S second #define de(...) cerr<<__VA_ARGS__ #define ar(a,s,t) {REP(__i,s,t)de(a[__i]<<' ');de(endl);} map<int,pii>mp; pii qr(int i){ if(mp.count(i))return mp[i]; else{ VI tt=ask(i); return mp[i]=pii(tt[0],tt[1]); } } void dfs(int l,int r,pii ll,pii rr,int mx,int&res){ if(res>=0)return; else{ pii tt=qr(mid); if(tt.F+tt.S==0)res=mid; if(l+1<r){ if(tt.F+tt.S==mx){ if(l<mid)dfs(l,mid,ll,qr(mid),mx,res); if(mid+1<r)dfs(mid+1,r,qr(mid+1),rr,mx,res); }else{ if(ll!=tt)dfs(l,mid,ll,tt,mx,res); if(tt!=rr)dfs(mid,r,tt,rr,mx,res); } } } } int find_best(int n){ int res=-1,mx=0; REP(i,0,min(n,10)){ pii tt=qr(i); mx=max(mx,tt.F+tt.S); } dfs(0,n,qr(0),pii(mx,0),mx,res); return res; }

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

prize.cpp: In function 'void dfs(int, int, pii, pii, int, int&)':
prize.cpp:11:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define mid (l+r>>1)
              ~^~
prize.cpp:31:13: note: in expansion of macro 'mid'
   pii tt=qr(mid);
             ^~~
prize.cpp:11:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define mid (l+r>>1)
              ~^~
prize.cpp:32:23: note: in expansion of macro 'mid'
   if(tt.F+tt.S==0)res=mid;
                       ^~~
prize.cpp:11:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define mid (l+r>>1)
              ~^~
prize.cpp:35:10: note: in expansion of macro 'mid'
     if(l<mid)dfs(l,mid,ll,qr(mid),mx,res);
          ^~~
prize.cpp:11:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define mid (l+r>>1)
              ~^~
prize.cpp:35:20: note: in expansion of macro 'mid'
     if(l<mid)dfs(l,mid,ll,qr(mid),mx,res);
                    ^~~
prize.cpp:11:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define mid (l+r>>1)
              ~^~
prize.cpp:35:30: note: in expansion of macro 'mid'
     if(l<mid)dfs(l,mid,ll,qr(mid),mx,res);
                              ^~~
prize.cpp:11:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define mid (l+r>>1)
              ~^~
prize.cpp:36:8: note: in expansion of macro 'mid'
     if(mid+1<r)dfs(mid+1,r,qr(mid+1),rr,mx,res);
        ^~~
prize.cpp:11:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define mid (l+r>>1)
              ~^~
prize.cpp:36:20: note: in expansion of macro 'mid'
     if(mid+1<r)dfs(mid+1,r,qr(mid+1),rr,mx,res);
                    ^~~
prize.cpp:11:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define mid (l+r>>1)
              ~^~
prize.cpp:36:31: note: in expansion of macro 'mid'
     if(mid+1<r)dfs(mid+1,r,qr(mid+1),rr,mx,res);
                               ^~~
prize.cpp:11:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define mid (l+r>>1)
              ~^~
prize.cpp:38:21: note: in expansion of macro 'mid'
     if(ll!=tt)dfs(l,mid,ll,tt,mx,res);
                     ^~~
prize.cpp:11:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define mid (l+r>>1)
              ~^~
prize.cpp:39:19: note: in expansion of macro 'mid'
     if(tt!=rr)dfs(mid,r,tt,rr,mx,res);
                   ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...