Submission #1021645

# Submission time Handle Problem Language Result Execution time Memory
1021645 2024-07-13T01:08:40 Z 12345678 Chameleon's Love (JOI20_chameleon) C++17
0 / 100
15 ms 484 KB
#include "chameleon.h"
#include <bits/stdc++.h>

using namespace std;

const int nx=1e3+5;

int vs[nx], v[nx][nx];
vector<int> d[nx];

void Solve(int N) {
    for (int i=1; i<=2*N; i++) for (int j=1; j<i; j++) if (Query(vector<int> {i, j})==1) d[i].push_back(j), d[j].push_back(i);
    for (int i=1; i<=2*N; i++)
    {
        if (vs[i]) continue;
        if (d[i].size()==1)
        {
            Answer(i, d[i][0]);
            vs[i]=vs[d[i][0]]=1;
            continue;
        }
        bool f=0;
        for (int j=0; j<3; j++)
        {
            vector<int> qrs;
            qrs.push_back(i);
            for (int k=0; k<3; k++) if (k!=j) qrs.push_back(d[i][k]);
            if (Query(qrs)==1) v[i][d[i][j]]=v[d[i][j]][i]=1;
        }
    }
    for (int i=1; i<=2*N; i++)
    {
        if (vs[i]) continue;
        for (int j=0; j<3; j++) if (!v[i][d[i][j]]) vs[i]=vs[d[i][j]]=1, Answer(i, d[i][j]);
    }
}

Compilation message

chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:22:14: warning: unused variable 'f' [-Wunused-variable]
   22 |         bool f=0;
      |              ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 15 ms 344 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 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 Incorrect 0 ms 344 KB Wrong Answer [5]
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 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 Incorrect 0 ms 344 KB Wrong Answer [5]
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 15 ms 484 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 15 ms 344 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -