제출 #597835

#제출 시각아이디문제언어결과실행 시간메모리
597835yanndev커다란 상품 (IOI17_prize)C++17
0 / 100
100 ms292 KiB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;

int find_best(int n) {
    for (int i = 0; i < n; i++) {
        vector<int> a = ask(i);
        if (a[0] == 0 && a[1] == 0)
            return i;
        
        int l = i;
        int r = n;
        while (l < r) {
            int m = (l + r) / 2;
            vector<int> b = ask(m);
            if (b[0] == a[0] && b[1] == a[1])
                l = m;
            else
                r = m - 1;
        }

        i = l;
    }
}

컴파일 시 표준 에러 (stderr) 메시지

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