Submission #923566

# Submission time Handle Problem Language Result Execution time Memory
923566 2024-02-07T12:19:38 Z alexander707070 Chameleon's Love (JOI20_chameleon) C++14
0 / 100
1 ms 344 KB
#include <bits/stdc++.h>
#include "chameleon.h"
#define MAXN 1007

using namespace std;

namespace {

int n,bad[MAXN];
vector<int> to[MAXN];
vector< pair<int,int> > sol;

vector<int> l,r,w;

void bin(){
    for(int curr:l){
        int lt=-1,rt=n,mid;
        while(lt+1<rt){
            mid=(lt+rt)/1;
            
            w.clear();
            for(int f=0;f<mid;f++)w.push_back(r[f]);
            w.push_back(curr);
            
            if(Query(w)!=w.size()){
                rt=mid;
            }else{
                lt=mid;
            }
        }
        /*
        if(rt!=n)to[curr].push_back(r[rt]);
        
        lt=rt; rt=n;
        while(lt+1<rt){
            mid=(lt+rt)/1;
            
            w.clear();
            for(int f=0;f<mid;f++)w.push_back(r[f]);
            w.push_back(curr);
            
            if(Query(w)!=w.size()){
                rt=mid;
            }else{
                lt=mid;
            }
        }
        
        if(rt!=n)to[curr].push_back(r[rt]);
        
        lt=rt; rt=n;
        while(lt+1<rt){
            mid=(lt+rt)/1;
            
            w.clear();
            for(int f=0;f<mid;f++)w.push_back(r[f]);
            w.push_back(curr);
            
            if(Query(w)!=w.size()){
                rt=mid;
            }else{
                lt=mid;
            }
        }
        
        if(rt!=n)to[curr].push_back(r[rt]);*/
    }
    
    for(int curr:r){
        int lt=-1,rt=n,mid;
        while(lt+1<rt){
            mid=(lt+rt)/1;
            
            w.clear();
            for(int f=0;f<mid;f++)w.push_back(l[f]);
            w.push_back(curr);
            
            if(Query(w)!=w.size()){
                rt=mid;
            }else{
                lt=mid;
            }
        }
        
        if(rt!=n)to[curr].push_back(l[rt]);
        /*
        lt=rt; rt=n;
        while(lt+1<rt){
            mid=(lt+rt)/1;
            
            w.clear();
            for(int f=0;f<mid;f++)w.push_back(l[f]);
            w.push_back(curr);
            
            if(Query(w)!=w.size()){
                rt=mid;
            }else{
                lt=mid;
            }
        }
        
        if(rt!=n)to[curr].push_back(l[rt]);
        
        lt=rt; rt=n;
        while(lt+1<rt){
            mid=(lt+rt)/1;
            
            w.clear();
            for(int f=0;f<mid;f++)w.push_back(l[f]);
            w.push_back(curr);
            
            if(Query(w)!=w.size()){
                rt=mid;
            }else{
                lt=mid;
            }
        }
        
        if(rt!=n)to[curr].push_back(l[rt]);*/
    }
}

}  // namespace

void Solve(int N) {
    n=N;
    for(int i=1;i<=2*n;i++){
        l.push_back(i);
        if(Query(l)!=l.size()){
            l.pop_back();
            r.push_back(i);
        }
    }
    
    bin();
    
    return;
    for(int i=1;i<=2*n;i++){
        if(to[i].size()==1)continue;
        else{
            if(Query({i,to[i][0],to[i][1]})==1)bad[i]=to[i][2];
            else if(Query({i,to[i][0],to[i][2]})==1)bad[i]=to[i][1];
            else if(Query({i,to[i][2],to[i][1]})==1)bad[i]=to[i][0];
        }
    }
    
    for(int i=1;i<=2*n;i++){
        for(int f:to[i]){
            if(bad[i]==f or bad[f]==i)continue;
            if(i<f)Answer(i,f);
        }
    }
}

Compilation message

chameleon.cpp: In function 'void {anonymous}::bin()':
chameleon.cpp:25:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |             if(Query(w)!=w.size()){
      |                ~~~~~~~~^~~~~~~~~~
chameleon.cpp:78:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   78 |             if(Query(w)!=w.size()){
      |                ~~~~~~~~^~~~~~~~~~
chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:129:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  129 |         if(Query(l)!=l.size()){
      |            ~~~~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -