Submission #937449

# Submission time Handle Problem Language Result Execution time Memory
937449 2024-03-04T05:12:54 Z guagua0407 Chameleon's Love (JOI20_chameleon) C++17
0 / 100
15 ms 500 KB
#include "chameleon.h"
#include<bits/stdc++.h>

namespace {

int n;

}  // namespace

void Solve(int N) {
    using namespace std;
    n=N;
    int B=31;
    vector<bool> used(2*n+1);
    int cnt=0;
    while(cnt<n){
        vector<int> vec;
        for(int i=1;i<=2*n;i++){
            if(used[i]) continue;
            int sz=vec.size();
            vec.push_back(i);
            if(Query(vec)==sz){
                vec.pop_back();
                for(auto v:vec){
                    if(Query({v,i})==1){
                        //cout<<v<<' '<<i<<'\n';
                        Answer(v,i);
                        used[v]=used[i]=true;
                        cnt++;
                        break;
                    }
                }
            }
            //else if((int)vec.size()>B) vec.pop_back();
        }
    }
}

Compilation message

chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:13:9: warning: unused variable 'B' [-Wunused-variable]
   13 |     int B=31;
      |         ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Incorrect 15 ms 500 KB Wrong Answer [3]
4 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 Incorrect 1 ms 344 KB Wrong Answer [3]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Incorrect 15 ms 500 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -