답안 #372434

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
372434 2021-02-28T07:22:31 Z KoD 카멜레온의 사랑 (JOI20_chameleon) C++17
40 / 100
22 ms 492 KB
#include <bits/stdc++.h>
#include "chameleon.h"

template <class T>
using Vec = std::vector<T>;

void Solve(int N) {
    Vec<Vec<int>> graph(2 * N + 1);
    for (int u = 1; u <= 2 * N; ++u) {
        for (int v = u + 1; v <= 2 * N; ++v) {
            const auto kinds = Query({ u, v });
            if (kinds == 1) {
                graph[u].push_back(v);
                graph[v].push_back(u);
            }
        }
    }
    Vec<Vec<char>> prob(2 * N + 1, Vec<char>(2 * N + 1));
    for (int u = 1; u <= 2 * N; ++u) {
        if (graph[u].size() == 1) {
            prob[u][graph[u].front()] = true;
        }
        else {
            assert(graph[u].size() == 3);
            for (int ignore = 0; ignore < 3; ++ignore) {
                Vec<int> ask;
                ask.push_back(u);
                for (int k = 0; k < 3; ++k) {
                    if (ignore != k) {
                        ask.push_back(graph[u][k]);
                    }
                }
                if (Query(ask) == 2) {
                    prob[u][graph[u][ignore]] = true;
                }
            }
        }
    }
    for (int u = 1; u <= 2 * N; ++u) {
        for (int v = u + 1; v <= 2 * N; ++v) {
            if (prob[u][v] && prob[v][u]) {
                Answer(u, v);
            }
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Incorrect 22 ms 384 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 492 KB Output is correct
10 Correct 2 ms 492 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 2 ms 364 KB Output is correct
13 Correct 2 ms 364 KB Output is correct
14 Correct 2 ms 364 KB Output is correct
15 Correct 2 ms 364 KB Output is correct
16 Correct 2 ms 364 KB Output is correct
17 Correct 2 ms 364 KB Output is correct
18 Correct 2 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 22 ms 364 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Incorrect 22 ms 384 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -