Submission #937267

# Submission time Handle Problem Language Result Execution time Memory
937267 2024-03-03T17:55:47 Z snpmrnhlol The Big Prize (IOI17_prize) C++17
0 / 100
2 ms 436 KB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
const int K = 500;
set <int> s;
int mx = 0,id = 0,cnt = 0;
int ans = -1;
void solve(int l,int r,int dl,int dr){
    cout<<l<<' '<<r<<' '<<dl<<' '<<dr<<'\n';
    if(dl + dr >= mx)return;
    if(l > r)return;
    int mij = (l + r)/2;
    for(int i = mij;i <= r;i++){
        auto x = ask(i);
        if(x[0] + x[1] == mx){
            x[0]-=dl;
            x[1]-=dr;
            solve(i + 1,r,x[0] + dl,dr);
            if(ans == -1)solve(l,mij - 1,dl,dr + x[1] + i - mij);
            return;
        }else{
            if(x[0] + x[1] == 0){
                ans = i;
                return;
            }
        }
    }
    solve(l,mij - 1,dl,dr);
    return;
}
int find_best(int n) {
    for(int i = 0;i < min(n,K);i++){
        auto x = ask(i);
        int nr = x[0] + x[1];
        if(nr == 0)return i;
        if(nr > mx){
            mx = nr;
        }
    }
    solve(0,n - 1,0,0);
	return ans;
}
/**
8
3 3 3 3 2 2 2 1
**/
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 432 KB Token "0" doesn't correspond to pattern "[A-B]{1}"
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 436 KB Token "0" doesn't correspond to pattern "[A-B]{1}"
2 Halted 0 ms 0 KB -