Submission #101917

# Submission time Handle Problem Language Result Execution time Memory
101917 2019-03-21T03:12:53 Z tim25871014 The Big Prize (IOI17_prize) C++17
Compilation error
0 ms 0 KB
#include "prize.h"
using namespace std;

int find_best(int n){

    int crd[200010]={};

    int loli=0;
    for(int i=0;i<500;i++){
        vector<int> ans=ask(i);
        loli=max(loli,ans[0]+ans[1]);
    }

    int l=0;
    while(ask(l)[1]!=0){
        int ub=n+1,lb=l;
        vector<int> ans;
        while(ub-lb>1){
            int mid=ub+lb>>1;
            if(!crd[mid]) ans=ask(mid);
            while((crd[mid])?(ans=ask(mid)),crd[mid] || ans[0]+ans[1]!=loli){
                crd[mid]=1;
                if(ans[0]+ans[1]==0) return mid;
                mid--;
            }
            if(ans[0]) ub=mid;
            else lb=mid;
        }
        ans=ask(lb);
        if(ans[0]+ans[1]==0) return lb;
        else l=lb+1;
    }
}

Compilation message

prize.cpp: In function 'int find_best(int)':
prize.cpp:19:23: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
             int mid=ub+lb>>1;
                     ~~^~~
prize.cpp:21:76: error: expected ':' before ')' token
             while((crd[mid])?(ans=ask(mid)),crd[mid] || ans[0]+ans[1]!=loli){
                                                                            ^
prize.cpp:21:76: error: expected primary-expression before ')' token
prize.cpp:33:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^