답안 #1050004

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1050004 2024-08-09T06:45:38 Z 근데 드레이븐이 문제에요 이 와중에 진짜 예 타워(#11105) 카멜레온의 사랑 (JOI20_chameleon) C++17
40 / 100
16 ms 448 KB
#include "chameleon.h"
#include <bits/stdc++.h>
using namespace std;

int n;
bool used[1005];

namespace {

int variable_example = 1;

}  // namespace

int f(int x,int y) {
    vector<int> v;
    v.push_back(x);
    v.push_back(y);
    return Query(v);
}

int f3(int x,int y,int z) {
    vector<int> v;
    v.push_back(x);
    v.push_back(y);
    v.push_back(z);
    return Query(v);
}

void Solve(int N) {
    n=N;
    for(int i=1;i<=n*2;i++) {
        if (used[i]) {
            continue;
        }
        vector<int> v;
        for(int j=1;j<=n*2;j++) {
            if (i!=j&&f(i,j)==1) {
                v.push_back(j);
            }
        }
        if (v.size()==1) {
            Answer(i,v[0]);
            used[i]=true;
            used[v[0]]=true;
            continue;
        }
        int now; //i���� ����޴�
        int now2;
        if (f3(i,v[0],v[1])==1) {
            now=v[0];
            now2=v[1];
        }
        else if (f3(i,v[0],v[2])==1) {
            now=v[0];
            now2=v[2];
        }
        else {
            now=v[1];
            now2=v[2];
        }
        vector<int> v2;
        for(int j=1;j<=n*2;j++) {
            if (now!=j&&f(now,j)==1) {
                v2.push_back(j);
            }
        }
        if (v2.size()==1) {
            if (v2[0]==i) {
                Answer(i,now);
                used[i]=true;
                used[now]=true;
                continue;
            }
            else {
                Answer(i,now2);
                used[i]=true;
                used[now2]=true;
                continue;
            }
        }
        else {
            vector<int> v3;
            for(int j=0;j<v2.size();j++) {
                if (v2[j]!=i) {
                    v3.push_back(v2[j]);
                }
            }
            if (f3(now,v3[0],v3[1])==1) {
                Answer(i,now2);
                used[i]=true;
                used[now2]=true;
                continue;
            }
            else {
                Answer(i,now);
                used[i]=true;
                used[now]=true;
                continue;
            }
        }
    }
}

Compilation message

chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:83:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   83 |             for(int j=0;j<v2.size();j++) {
      |                         ~^~~~~~~~~~
chameleon.cpp: At global scope:
chameleon.cpp:10:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
   10 | int variable_example = 1;
      |     ^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 16 ms 448 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 2 ms 344 KB Output is correct
11 Correct 2 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 2 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 2 ms 344 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 13 ms 344 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 16 ms 448 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -