Submission #820813

# Submission time Handle Problem Language Result Execution time Memory
820813 2023-08-11T06:08:32 Z ZHIRDILBILDIZ The Big Prize (IOI17_prize) C++14
20 / 100
81 ms 296 KB
#include<bits/stdc++.h>
#include "prize.h"
using namespace std ;
//vector<int> ask(int ind)
//{
//    vector<int> v(2) ;
//    cout << "? " << ind << '\n' ;
//    cin >> v[0] >> v[1] ;
//    return v ;
//}
int find_best(int n)
{
    bool flag = 0 ;
    int l = -1, r = n, cnt = 0 ;
    while(l + 1 < r)
    {
        int mid = (l + r) / 2 ;
        cnt++ ;
        vector<int> v = ask(mid) ;
        if(v[0] && v[1])
        {
            flag = 1 ;
            break ;
        }
        if(!v[0] && !v[1])
            return mid ;
        else
        {
            if(v[0])
                r = mid ;
            else
                l = mid ;
        }
    }
    if(!flag)
        return l ;
    int ind = 0 ;
    while(ind < n)
    {
        cnt++ ;
        vector<int> abu = ask(ind) ;
        if(cnt == 10000)
        {
            while(true)
            {
            }
        }
        if(!abu[0] && !abu[1])
            return ind ;
        int l = ind, r = n ;
        while(l + 1 < r)
        {
            int mid = (l + r) >> 1 ;
            vector<int> now = ask(mid) ;
            if(cnt == 10000)
            {
                while(true)
                {
                }
            }
            cnt++ ;
            if(!now[0] && !now[1])
                return mid ;
            else
            {
                if(now[0] == abu[0] && now[1] == abu[1])
                    l = mid ;
                else
                    r = mid ;
            }
        }
        ind = l + 1 ;
    }
}
//signed main()
//{
//    int n ;
//    cin >> n ;
//    cout<<find_best(n) ;
//    return 0 ;
//}

Compilation message

prize.cpp: In function 'int find_best(int)':
prize.cpp:74:1: warning: control reaches end of non-void function [-Wreturn-type]
   74 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 292 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 0 ms 292 KB Output is correct
4 Correct 1 ms 288 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 0 ms 292 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 292 KB Output is correct
2 Correct 0 ms 288 KB Output is correct
3 Correct 1 ms 296 KB Output is correct
4 Correct 1 ms 292 KB Output is correct
5 Correct 0 ms 292 KB Output is correct
6 Correct 0 ms 292 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 292 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Correct 4 ms 208 KB Output is correct
12 Correct 1 ms 208 KB Output is correct
13 Correct 6 ms 292 KB Output is correct
14 Correct 6 ms 208 KB Output is correct
15 Correct 21 ms 272 KB Output is correct
16 Incorrect 81 ms 288 KB Incorrect
17 Halted 0 ms 0 KB -