Submission #371338

# Submission time Handle Problem Language Result Execution time Memory
371338 2021-02-26T13:55:29 Z leinad2 The Big Prize (IOI17_prize) C++17
20 / 100
118 ms 492 KB
#include "prize.h"
#include<bits/stdc++.h>
using namespace std;
int gg(int a, int b){if(a==0)return b;return a;}
int f(int l, int r)
{
    if(l>r)return 0;
    int m=l+r>>1;
    vector<int>v=ask(m);
    if(v[0]==0&&v[1]==0)return m;
    if(v[1]==0)return f(l, m-1);
    if(v[0]==0)return f(m+1, r);
    return gg(f(l, m-1), f(m+1, r));
}
int find_best(int n)
{
    return f(0, n-1);
}

Compilation message

prize.cpp: In function 'int f(int, int)':
prize.cpp:8:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
    8 |     int m=l+r>>1;
      |           ~^~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Incorrect 118 ms 364 KB Incorrect
12 Halted 0 ms 0 KB -