Submission #1008262

# Submission time Handle Problem Language Result Execution time Memory
1008262 2024-06-26T08:41:39 Z bachhoangxuan The Big Prize (IOI17_prize) C++17
0 / 100
2 ms 9824 KB
#include "prize.h"
#include<bits/stdc++.h>
using namespace std;
const int maxn = 2e5+5;
int a[maxn];
set<int> s[maxn];

int find_best(int n) {
    function<int(int,int)> f = [&](int l,int r){
        if(l>r) return -1;
        int m=(l+r)>>1;
        vector<int> v=ask(m);
        int k=(a[m]=v[0])+v[1];
        if(!k) return m;
        auto it=s[k].insert(m).first;
        if(it!=s[k].begin() && a[*prev(it)]!=a[m]){
            int x=f(l,m-1);
            if(x!=-1) return x;
        }
        if(next(it)!=s[k].end() && a[m]!=a[*next(it)]){
            int x=f(m+1,r);
            if(x!=-1) return x;
        }
        return -1;
    };
    return f(0,n-1);
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 9816 KB Integer -1 violates the range [0, 199999]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 9824 KB Integer -1 violates the range [0, 199999]
2 Halted 0 ms 0 KB -