Submission #103072

#TimeUsernameProblemLanguageResultExecution timeMemory
103072usernameThe Big Prize (IOI17_prize)C++14
20 / 100
79 ms876 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,int mx,int&res){ if(res>=0)return; else{ if(qr(mid).F+qr(mid).S==0)res=mid; if(l<=mid-1&&!(qr(l)==qr(mid-1)&&qr(l).F+qr(l).S==mx))dfs(l,mid-1,mx,res); if(mid+1<=r&&!(qr(mid+1)==qr(r)&&qr(r).F+qr(r).S==mx))dfs(mid+1,r,mx,res); } } int find_best(int n){ int res=-1,mx=0; REP(i,0,min(n,30)){ mx=max(mx,qr(i).F+qr(i).S); } dfs(0,n-1,mx,res); return res; }

Compilation message (stderr)

prize.cpp: In function 'void dfs(int, int, int, int&)':
prize.cpp:11:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define mid (l+r>>1)
              ~^~
prize.cpp:31:9: note: in expansion of macro 'mid'
   if(qr(mid).F+qr(mid).S==0)res=mid;
         ^~~
prize.cpp:11:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define mid (l+r>>1)
              ~^~
prize.cpp:31:19: note: in expansion of macro 'mid'
   if(qr(mid).F+qr(mid).S==0)res=mid;
                   ^~~
prize.cpp:11:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define mid (l+r>>1)
              ~^~
prize.cpp:31:33: note: in expansion of macro 'mid'
   if(qr(mid).F+qr(mid).S==0)res=mid;
                                 ^~~
prize.cpp:11:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define mid (l+r>>1)
              ~^~
prize.cpp:32:9: note: in expansion of macro 'mid'
   if(l<=mid-1&&!(qr(l)==qr(mid-1)&&qr(l).F+qr(l).S==mx))dfs(l,mid-1,mx,res);
         ^~~
prize.cpp:11:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define mid (l+r>>1)
              ~^~
prize.cpp:32:28: note: in expansion of macro 'mid'
   if(l<=mid-1&&!(qr(l)==qr(mid-1)&&qr(l).F+qr(l).S==mx))dfs(l,mid-1,mx,res);
                            ^~~
prize.cpp:11:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define mid (l+r>>1)
              ~^~
prize.cpp:32:63: note: in expansion of macro 'mid'
   if(l<=mid-1&&!(qr(l)==qr(mid-1)&&qr(l).F+qr(l).S==mx))dfs(l,mid-1,mx,res);
                                                               ^~~
prize.cpp:11:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define mid (l+r>>1)
              ~^~
prize.cpp:33:6: note: in expansion of macro 'mid'
   if(mid+1<=r&&!(qr(mid+1)==qr(r)&&qr(r).F+qr(r).S==mx))dfs(mid+1,r,mx,res);
      ^~~
prize.cpp:11:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define mid (l+r>>1)
              ~^~
prize.cpp:33:21: note: in expansion of macro 'mid'
   if(mid+1<=r&&!(qr(mid+1)==qr(r)&&qr(r).F+qr(r).S==mx))dfs(mid+1,r,mx,res);
                     ^~~
prize.cpp:11:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define mid (l+r>>1)
              ~^~
prize.cpp:33:61: note: in expansion of macro 'mid'
   if(mid+1<=r&&!(qr(mid+1)==qr(r)&&qr(r).F+qr(r).S==mx))dfs(mid+1,r,mx,res);
                                                             ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...