Submission #568132

# Submission time Handle Problem Language Result Execution time Memory
568132 2022-05-24T16:55:21 Z alvingogo Chameleon's Love (JOI20_chameleon) C++14
0 / 100
155 ms 464 KB
#include <bits/stdc++.h>
#include "chameleon.h"
#pragma GCC optimize("Ofast")
#define fs first
#define sc second
#define cd complex<double>
#define p_q priority_queue
using namespace std;

void Solve(int N){
    int n=2*N;
    vector<vector<int> > v(n+1);
    vector<int> vis(n+1);
    vector<int> q(n);
    vector<pair<int,int> >ans;
    iota(q.begin(),q.end(),1);
    for(int i=1;i<=n;i++){
        vector<int> tmp;
        if(vis[i]){
            continue;
        }
        tmp.push_back(i);
        for(int j=i+1;j<=n;j++){
            if(vis[j]){
                continue;
            }
            tmp.push_back(j);
            if(Query(tmp)==1){
                int z=0;
                vector<int> p;
                for(int k=1;k<=n;k++){
                    if(k==i || k==j){
                        continue;
                    }
                    p.push_back(k);
                }
                if(Query(p)==N-1){
                    for(int k=1;k<=n;k++){
                        if(k==i || k==j){
                            continue;
                        }
                        vector<int> y;
                        for(int l=1;l<=n;l++){
                            if(l==i || l==j || l==k){
                                continue;
                            }
                            y.push_back(l);
                        }
                        z=max(z,Query(y));
                        if(z==N){
                            break;
                        }
                    }
                    if(z==N-1){
                        ans.push_back({i,j});
                        vis[i]=vis[j]=1;
                        break;
                    }
                }
            }
            tmp.pop_back();
        }
    }
    assert(ans.size()>=N);
    for(auto h:ans){
        Answer(h.fs,h.sc);
    }
}

Compilation message

In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from chameleon.cpp:1:
chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:64:22: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   64 |     assert(ans.size()>=N);
      |            ~~~~~~~~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Incorrect 155 ms 336 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Runtime error 1 ms 464 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Runtime error 1 ms 464 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Runtime error 1 ms 464 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Incorrect 155 ms 336 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -