Submission #1035998

#TimeUsernameProblemLanguageResultExecution timeMemory
1035998vjudge1Chameleon's Love (JOI20_chameleon)C++17
4 / 100
6 ms492 KiB
#include "chameleon.h"
#include <bits/stdc++.h>
using namespace std;
int match[10100];
vector<int> cantfind;
void dnc(int n,vector<int>v){
    if(v.size()==1)return void(match[n]=v[0]);
    vector<int>a,b;
    for(int i=0;i<v.size();i++)
        if(i%2)a.push_back(v[i]);
        else b.push_back(v[i]);
    a.push_back(n);
    int K=Query(a);
    a.pop_back();
    if(K-a.size())dnc(n,b);
    else dnc(n,a);
}
void Solve(int N) {
    for(int i=1;i<=2*N;i++) {
        cantfind.push_back(i);
        if(Query(cantfind)<cantfind.size()){
            cantfind.pop_back();
            dnc(i,cantfind);
            cantfind.erase(lower_bound(cantfind.begin(),cantfind.end(),match[i]));
        }
    }
    for(int i=1;i<=2*N;i++)
        if(match[i])
            Answer(i,match[i]);
}

Compilation message (stderr)

chameleon.cpp: In function 'void dnc(int, std::vector<int>)':
chameleon.cpp:9:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     for(int i=0;i<v.size();i++)
      |                 ~^~~~~~~~~
chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:21:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |         if(Query(cantfind)<cantfind.size()){
      |            ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
#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...