Submission #804694

# Submission time Handle Problem Language Result Execution time Memory
804694 2023-08-03T10:53:44 Z Ellinor The Big Prize (IOI17_prize) C++14
20 / 100
1 ms 344 KB
#include <bits/stdc++.h>
using namespace std;

#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;

#include "prize.h"

int find_best(int n) 
{
    int ans;
    int low = 0, high = n - 1;
    int mid;
    while (low <= high)
    {
        mid = (low + high) / 2;

        std::vector<int> res = ask(mid);
        if(res[0] + res[1] == 0) ans = mid;

        if (res[0] > res[1]) high = mid - 1;
        else low = mid + 1;
    }

	return ans;
}

Compilation message

prize.cpp: In function 'int find_best(int)':
prize.cpp:27:9: warning: 'ans' may be used uninitialized in this function [-Wmaybe-uninitialized]
   27 |  return ans;
      |         ^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 288 KB Output is correct
4 Correct 1 ms 292 KB Output is correct
5 Correct 1 ms 312 KB Output is correct
6 Correct 1 ms 288 KB Output is correct
7 Correct 1 ms 312 KB Output is correct
8 Correct 1 ms 276 KB Output is correct
9 Correct 0 ms 288 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 292 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 ms 296 KB Output is correct
5 Correct 1 ms 312 KB Output is correct
6 Correct 0 ms 292 KB Output is correct
7 Correct 1 ms 296 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Incorrect 1 ms 208 KB answer is not correct
12 Halted 0 ms 0 KB -