제출 #1076810

#제출 시각아이디문제언어결과실행 시간메모리
1076810vjudge1커다란 상품 (IOI17_prize)C++17
90 / 100
63 ms424 KiB
#include "prize.h"
#include<bits/stdc++.h>

using namespace std;

typedef pair<int, int> ii;
typedef long long ll;
typedef vector<ii> vii;
typedef vector<ll> vll;
typedef pair<long long, long long> pll;
typedef pair<char, int> ci;
typedef pair<string, int> si;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
#define pb push_back
#define fi first
#define se second
#define whole(v) v.begin(), v.end()
#define rwhole(v) v.rbegin(), v.rend()
#define inf INT_MAX/2
#define fro front

int find_best(int n) {
    int ma = 0;
    for(int i = 0; i < min(480,  n); ++i){
        vi x = ask(i);
        if(x[0] + x[1] == 0){
            return i;
        }
        ma = max(ma, x[0] + x[1]);
    }
    for(int i = 480; i < n; ++i){
        vi x = ask(i);
        if(x[0] + x[1] == ma){
            int lo = i;
            int hi = n;
            while(hi - lo > 1){
                int mid = lo + (hi - lo) / 2;
                vi y = ask(mid);
                if(y[0] == x[0] && y[1] == x[1]){
                    lo = mid;
                }else{
                    hi = mid;
                }
            }
            i = lo;
        }else{
            if(x[0] + x[1] == 0){
                return i;
            }
        }
    }
}

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

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