Submission #1171121

#TimeUsernameProblemLanguageResultExecution timeMemory
1171121SmuggingSpunChameleon's Love (JOI20_chameleon)C++20
4 / 100
12 ms436 KiB
#include "chameleon.h"
#include<bits/stdc++.h>
using namespace std;
void Solve(int n){
    vector<int>p(1, 1);
    for(int i = 2, pre_ans = 1; i <= (n << 1); i++){
        p.emplace_back(i);
        if(Query(p) == pre_ans){
            p.pop_back();
            int low = 0, high = int(p.size()) - 2, pos = high + 1;
            while(low <= high){
                int mid = (low + high) >> 1;
                vector<int>pp;
                for(int j = 0; j <= mid; j++){
                    pp.emplace_back(p[j]);
                }
                pp.emplace_back(i);
                if(Query(pp) == pp.size()){
                    low = mid + 1;
                }
                else{
                    high = (pos = mid) - 1;
                }
            }
            Answer(p[pos], i);
        }
        else{
            pre_ans++;
        }
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...