Submission #427112

#TimeUsernameProblemLanguageResultExecution timeMemory
427112MOUF_MAHMALATThe Big Prize (IOI17_prize)C++14
20 / 100
110 ms320 KiB
#include "prize.h"
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
vector<ll>v,w,x;
int find_best(int n)
{
    v=ask(0);
    for(ll i=199; i<n; i+=200)
    {
        w=ask(i);
        if(w[0]+w[1]==0)
            return i;
        if(v!=w)
        {
            for(ll j=i-199; j<i; j++)
            {
                x=ask(j);
                if(x[0]+x[1]==0)
                    return j;
            }
            v=w;
        }
    }
    for(ll i=n-1; i>=max(0,n-199); i--)
    {
        v=ask(i);
        if(v[0]+v[1]==0)
            return i;
    }
}

Compilation message (stderr)

prize.cpp: In function 'int find_best(int)':
prize.cpp:31:1: warning: control reaches end of non-void function [-Wreturn-type]
   31 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...