Submission #1000273

# Submission time Handle Problem Language Result Execution time Memory
1000273 2024-06-17T07:46:30 Z Unforgettablepl Chameleon's Love (JOI20_chameleon) C++17
40 / 100
21 ms 476 KB
#include <bits/stdc++.h>
using namespace std;
 
int Query(const std::vector<int> &p);
void Answer(int a, int b);

void Solve(int N) {
    int n = N;
    vector<vector<int>> adj(2*n+1);
    set<pair<int,int>> edges;
    for(int i=1;i<=2*n;i++){
        for(int j=i+1;j<=2*n;j++){
            if(Query({i,j})==1){
                edges.insert({i,j});
                adj[i].emplace_back(j);
                adj[j].emplace_back(i);
            }
        }
    }
    for(int i=1;i<=2*n;i++){
        if(adj[i].size()==1)continue;
        assert(adj[i].size()==3);
        if(Query({i,adj[i][0],adj[i][1]})==1)edges.erase({min(i,adj[i][2]),max(i,adj[i][2])});
        else if(Query({i,adj[i][0],adj[i][2]})==1)edges.erase({min(i,adj[i][1]),max(i,adj[i][1])});
        else edges.erase({min(i,adj[i][0]),max(i,adj[i][0])});
    }
    for(auto[a,b]:edges)Answer(a,b);
}
# 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 476 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 1 ms 368 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 1 ms 368 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 344 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 21 ms 476 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 476 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -