Submission #995170

# Submission time Handle Problem Language Result Execution time Memory
995170 2024-06-08T14:39:40 Z 12345678 Chameleon's Love (JOI20_chameleon) C++17
40 / 100
15 ms 528 KB
#include "chameleon.h"
#include <bits/stdc++.h>

using namespace std;

const int nx=1e3+5;

int vs[nx];
vector<int> d[nx];
set<int> s[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;
        }
        for (auto x:d[i])
        {
            for (auto y:d[x])
            {
                if (y!=i&&Query(vector<int> {i, x, y})==1) s[i].insert(x);
            }
        }
    }
    for (int i=1; i<=2*N; i++)
    {
        if (vs[i]) continue;
        for (auto x:s[i]) if (s[x].find(i)!=s[x].end()) vs[i]=vs[x]=1, Answer(i, x);
    }
}
# 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 528 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 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 1 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
# 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 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 1 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 1 ms 344 KB Output is correct
11 Correct 1 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 1 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 428 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
# 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 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 15 ms 528 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -