답안 #397618

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
397618 2021-05-02T14:53:04 Z rocks03 커다란 상품 (IOI17_prize) C++14
20 / 100
116 ms 328 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define pb push_back
#define SZ(x) ((int)(x).size())
#define all(x) x.begin(), x.end()
#define debug(x) cout << #x << ": " << x << " "
#define nl cout << "\n"
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define per(i, a, b) for(int i = (a); i >= (b); i--)
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

vector<int> ask(int i);

int cerca(int x, int ql, int qr){
    assert(ql <= qr);
    int l = ql, r = qr + 1;
    while(r - l > 1){
        int m = (l + r) / 2;
        vector<int> res = ask(m);
        res[0] -= x;
        if(res[0] < 0){
            l = m; break;
        } else if(res[0] == 0) l = m;
        else r = m;
    }
    vector<int> res = ask(l);
    if(res[0] == 0 && res[1] == 0){
        return l;
    }
    return cerca(res[0], l + 1, qr);
}

int find_best(int N){
    return cerca(0, 0, N - 1);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 200 KB Output is correct
5 Correct 1 ms 200 KB Output is correct
6 Correct 1 ms 200 KB Output is correct
7 Correct 1 ms 284 KB Output is correct
8 Correct 1 ms 200 KB Output is correct
9 Correct 1 ms 292 KB Output is correct
10 Correct 1 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 320 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 292 KB Output is correct
4 Correct 1 ms 288 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 1 ms 200 KB Output is correct
7 Correct 1 ms 200 KB Output is correct
8 Correct 1 ms 200 KB Output is correct
9 Correct 1 ms 284 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 6 ms 200 KB Output is correct
12 Correct 1 ms 288 KB Output is correct
13 Correct 13 ms 200 KB Output is correct
14 Correct 6 ms 200 KB Output is correct
15 Incorrect 116 ms 284 KB Incorrect
16 Halted 0 ms 0 KB -