Submission #1035998

# Submission time Handle Problem Language Result Execution time Memory
1035998 2024-07-27T00:41:00 Z vjudge1 Chameleon's Love (JOI20_chameleon) C++17
4 / 100
6 ms 492 KB
#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

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 time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 6 ms 492 KB Output is correct
4 Correct 6 ms 344 KB Output is correct
5 Correct 6 ms 344 KB Output is correct
6 Correct 6 ms 344 KB Output is correct
7 Correct 6 ms 472 KB Output is correct
8 Correct 6 ms 492 KB Output is correct
9 Correct 6 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 6 ms 492 KB Output is correct
4 Correct 6 ms 344 KB Output is correct
5 Correct 6 ms 344 KB Output is correct
6 Correct 6 ms 344 KB Output is correct
7 Correct 6 ms 472 KB Output is correct
8 Correct 6 ms 492 KB Output is correct
9 Correct 6 ms 460 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Incorrect 0 ms 344 KB Wrong Answer [6]
12 Halted 0 ms 0 KB -