Submission #617096

# Submission time Handle Problem Language Result Execution time Memory
617096 2022-08-01T08:41:03 Z 박상훈(#8502) Chameleon's Love (JOI20_chameleon) C++17
40 / 100
19 ms 340 KB
#include "chameleon.h"
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

namespace {

int n;
bool chk[1010];
vector<int> adj[1010];

}  // namespace


void Solve(int N) {
    n = N;

    for (int i=1;i<=n*2;i++){
        for (int j=i+1;j<=n*2;j++){
            if (Query({i, j})==1){
                adj[i].push_back(j);
                adj[j].push_back(i);
            }
        }
    }

    for (int i=1;i<=n*2;i++) if (adj[i].size()!=1){
        assert(adj[i].size()==3);
        for (int k=0;k<3;k++){
            vector<int> tmp = {i};
            for (int l=0;l<3;l++) if (k!=l) tmp.push_back(adj[i][l]);
            if (Query(tmp)==1){
                adj[i].erase(adj[i].begin()+k);
                break;
            }
        }
    }

    for (int i=1;i<=n*2;i++) if (!chk[i]){
        for (int k=0;k<(int)adj[i].size();k++){
            int v = adj[i][k];
            if (find(adj[v].begin(), adj[v].end(), i)==adj[v].end()) continue;
            Answer(i, v);
            chk[i] = 1, chk[v] = 1;
        }
        assert(chk[i]);
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 336 KB Output is correct
2 Correct 0 ms 336 KB Output is correct
3 Incorrect 19 ms 316 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 336 KB Output is correct
2 Correct 0 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 0 ms 336 KB Output is correct
6 Correct 0 ms 336 KB Output is correct
7 Correct 0 ms 336 KB Output is correct
8 Correct 0 ms 336 KB Output is correct
9 Correct 0 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 336 KB Output is correct
2 Correct 0 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 0 ms 336 KB Output is correct
6 Correct 0 ms 336 KB Output is correct
7 Correct 0 ms 336 KB Output is correct
8 Correct 0 ms 336 KB Output is correct
9 Correct 0 ms 336 KB Output is correct
10 Correct 3 ms 340 KB Output is correct
11 Correct 2 ms 336 KB Output is correct
12 Correct 2 ms 336 KB Output is correct
13 Correct 2 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 2 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 0 ms 336 KB Output is correct
3 Incorrect 18 ms 340 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 336 KB Output is correct
2 Correct 0 ms 336 KB Output is correct
3 Incorrect 19 ms 316 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -