답안 #734040

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
734040 2023-05-01T14:18:13 Z mosiashvililuka 카멜레온의 사랑 (JOI20_chameleon) C++14
20 / 100
30 ms 332 KB
#include<bits/stdc++.h>
#include "chameleon.h"
using namespace std;
int a,b,c,d,e,i,j,ii,jj,zx,xc,bo[1009],lef,rig,mid,in[1009],out[1009];
vector <int> v,vv;
int determine(vector <int> q){
    //cout<<q.size()<<" q\n";
    vector <int> v;
    int A[5];
    v.clear();
    v.push_back(q[0]);v.push_back(q[1]);v.push_back(q[2]);
    A[1]=Query(v);
    v.clear();
    v.push_back(q[0]);v.push_back(q[1]);v.push_back(q[3]);
    A[2]=Query(v);
    v.clear();
    v.push_back(q[0]);v.push_back(q[2]);v.push_back(q[3]);
    A[3]=Query(v);
    //cout<<A[1]<<" "<<A[2]<<" "<<A[3]<<" A\n";
    if(A[1]==A[2]) return q[1];
    if(A[1]==A[3]) return q[2];
    if(A[2]==A[3]) return q[3];
}
void Solve(int NN) {
/*  std::vector<int> p(3);
  p[0] = 1;
  p[1] = 2;
  p[2] = 3;
  variable_example = Query(p);
  for (int i = 0; i < N; ++i) {
    Answer(i * 2 + 1, i * 2 + 2);
  }*/
    a=NN;
    for(i=0; i<=2*a+1; i++){
        bo[i]=0;
    }
    /*for(int TA=1; TA<=a; TA++){
        v.clear();
        for(j=1; j<=2*a; j++){
            if(bo[j]==0){
                v.push_back(j);
            }
        }
        lef=-1;rig=v.size();
        while(1){
            if(lef+1>=rig) break;
            mid=(lef+rig)/2;
            vv.clear();
            for(i=0; i<=mid; i++){
                vv.push_back(v[i]);
            }
            c=Query(vv);
            if(c==vv.size()){
                lef=mid;
            }else{
                rig=mid;
            }
        }
        ii=rig;
        lef=-1;rig=ii;
        while(1){
            if(lef+1>=rig) break;
            mid=(lef+rig)/2;
            vv.clear();
            for(i=mid; i<=ii; i++){
                vv.push_back(v[i]);
            }
            c=Query(vv);
            //cout<<mid<<" "<<c<<"\n";
            if(c==vv.size()){
                rig=mid;
            }else{
                lef=mid;
            }
        }
        jj=lef;
        //cout<<jj<<" "<<ii<<"   "<<v[jj]<<" "<<v[ii]<<"\n";
        Answer(v[jj],v[ii]);
        bo[v[ii]]=1;bo[v[jj]]=1;
    }*/
    for(i=1; i<=a*2; i++){
        if(bo[i]!=0) continue;
        vv.clear();
        vv.push_back(i);
        for(j=1; j<=a*2; j++){
            if(i==j) continue;
            v.clear();
            v.push_back(i);v.push_back(j);
            c=Query(v);
            //cout<<i<<" "<<j<<": "<<c<<"\n";
            if(c==1){
                vv.push_back(j);
            }
        }
        //break;
        /*if(vv.size()>2) c=determine(vv); else c=vv[1];
        cout<<i<<" "<<c<<" ANSA\n";
        Answer(i,c);
        bo[i]=1;bo[c]=1;*/
        if(vv.size()>2){
            c=determine(vv);//romelic shedis i-shi
            in[i]=c;
            out[c]=i;
        }else{
            c=vv[1];
            Answer(i,c);
            bo[i]=1;bo[c]=1;
        }
    }


    for(i=1; i<=a*2; i++){
        if(bo[i]!=0) continue;
        jj=0;
        for(j=1; j<=a*2; j++){
            if(i==j) continue;
            if(j==in[i]||j==out[i]) continue;
            v.clear();
            v.push_back(i);v.push_back(j);
            c=Query(v);
            if(c==1){
                jj=j;break;
            }
        }
        Answer(i,jj);
        bo[i]=1;bo[jj]=1;
    }
}

Compilation message

chameleon.cpp: In function 'int determine(std::vector<int>)':
chameleon.cpp:8:18: warning: control reaches end of non-void function [-Wreturn-type]
    8 |     vector <int> v;
      |                  ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Incorrect 21 ms 208 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 1 ms 240 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 1 ms 240 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 4 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Incorrect 3 ms 256 KB Wrong Answer [5]
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Incorrect 30 ms 208 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Incorrect 21 ms 208 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -