답안 #718121

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
718121 2023-04-03T11:33:29 Z Jarif_Rahman 커다란 상품 (IOI17_prize) C++17
0 / 100
8 ms 9980 KB
#include "prize.h"
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;

vector<int> asked[200000];
vector<int> Ask(int i){
    if(asked[i].empty()) asked[i] = ask(i);
    return asked[i];
}

int find_best(int n){
    int p = 0;

    map<int, int> mp;

    while(1){
        auto cur = Ask(p);
        if(cur[0]+cur[1] == 0) return p;
        int a = p+1, b = n-1;
        while(a < b){
            int md = (a+b)/2;
            auto v = Ask(md);
            if(v[0]+v[1] > cur[0]+cur[1]) b = md;
            else if(v[0] > cur[0]) b = md-1;
            else a = md+1;
        }
        p = a;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4944 KB Output is correct
2 Runtime error 6 ms 9868 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4996 KB Output is correct
2 Runtime error 8 ms 9980 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -