답안 #269530

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
269530 2020-08-17T07:39:10 Z 문홍윤(#5112) 카멜레온의 사랑 (JOI20_chameleon) C++17
40 / 100
18 ms 384 KB
#include "chameleon.h"
#include <bits/stdc++.h>
#define eb emplace_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define svec(x) sort(x.begin(), x.end())
#define press(x) x.erase(unique(x.begin(), x.end()), x.end())
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef pair<int, LL> pil;
typedef pair<LL, int> pli;
const LL llinf=2e18;
const int inf=1e9;

int n;
vector<int> link[1010];
bool ch[1010];

void Solve(int N){
    n=N;
    for(int i=1; i<=2*n; i++){
        for(int j=1; j<i; j++){
            vector<int> qu;
            qu.eb(j); qu.eb(i);
            if(Query(qu)==1){
                link[i].eb(j);
                link[j].eb(i);
            }
        }
    }
    for(int i=1; i<=2*n; i++){
        if(link[i].size()<=2)continue;
        assert(link[i].size()==3);
        vector<int> qu;
        for(int j=0; j<3; j++){
            qu.clear();
            qu.eb(i);
            for(auto k:link[i]){
                if(link[i][j]==k)continue;
                qu.eb(k);
            }
            if(Query(qu)==1){
                swap(link[i][j], link[i][2]);
                link[i].pop_back();
                break;
            }
        }
    }
    for(int i=1; i<=2*n; i++){
        if(ch[i])continue;
        for(auto j:link[i]){
            bool flg=false;
            for(auto k:link[j]){
                if(k==i)flg=true;
            }
            if(flg){
                Answer(i, j);
                ch[i]=ch[j]=true;
                break;
            }
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Incorrect 18 ms 384 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Incorrect 18 ms 384 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Incorrect 18 ms 384 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -