제출 #753238

#제출 시각아이디문제언어결과실행 시간메모리
753238boyliguanhan커다란 상품 (IOI17_prize)C++17
100 / 100
75 ms10808 KiB
#include "prize.h"
#include<bits/stdc++.h>
using namespace std;
set<int> st[200100];
int l[200100];
int calc(int x, int y) {
    if(x>y)return-1;
    int z = x+y>>1;
    vector<int>v=ask(z);
    int k=(l[z]=v[0])+v[1], t=-1;
    if(!k) return z;
    auto a = st[k].insert(z).first;
    if(a==st[k].begin()||l[*prev(a)]<l[z])
        t = max(t, calc(x, z-1));
    if(a==(--st[k].end())||l[*next(a)]>l[z])
        t = max(t, calc(z+1, y));
    return t;
}
int find_best(int n) {
	return calc(0,n-1);
}

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

prize.cpp: In function 'int calc(int, int)':
prize.cpp:8:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
    8 |     int z = x+y>>1;
      |             ~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...