Submission #1036198

# Submission time Handle Problem Language Result Execution time Memory
1036198 2024-07-27T05:02:03 Z vjudge1 Chameleon's Love (JOI20_chameleon) C++17
64 / 100
31 ms 556 KB
#include "chameleon.h"
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
vector<int>edges[1010];
vector<int> likehell[4];
int lik[1010];
void proc(int i){
    if(edges[i].size()<2)return;
    vector<int>v=edges[i];
    v.push_back(i);
    for(auto k:edges[i]){
        v.erase(find(all(v),k));
        if(Query(v)<2)
            lik[i]=k;
        v.push_back(k);
    }
}
int AE(int a,int b){
    edges[a].push_back(b);
    edges[b].push_back(a);
    return b;
}
int dnc(int i,vector<int> v){
    v.pop_back();
    if(v.size()==1) return AE(i,v[0]);
    vector<int>a,b;
    for(int i=0;i<v.size();i++)
        (i%2?a:b).push_back(v[i]);
    a.push_back(i);
    b.push_back(i);
    return dnc(i,Query(a)<a.size()?a:b);
}
void Solve(int N) {
    for(int i=1;i<=2*N;i++) {
        int apos=0;
        for(int j=0;j<4;j++){
            if(likehell[j].size()){
                vector<int>v=likehell[j];
                v.push_back(i);
                while(Query(v)<v.size())
                    v.erase(find(all(v),dnc(i,v)));
                if(v.size()>likehell[j].size())
                    apos=j;
            }else apos=j;
        }
        likehell[apos].push_back(i);
    }
    for(int i=1;i<=2*N;i++)
        proc(i);
    for(int i=1;i<=2*N;i++)
        if(lik[i])edges[i].erase(find(all(edges[i]),lik[i])),
            edges[lik[i]].erase(find(all(edges[lik[i]]),i));
    for(int i=1;i<=2*N;i++)
        if(edges[i][0]>i)
            Answer(edges[i][0],i);
}

Compilation message

chameleon.cpp: In function 'int dnc(int, std::vector<int>)':
chameleon.cpp:28:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |     for(int i=0;i<v.size();i++)
      |                 ~^~~~~~~~~
chameleon.cpp:32:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     return dnc(i,Query(a)<a.size()?a:b);
      |                  ~~~~~~~~^~~~~~~~~
chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:41:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |                 while(Query(v)<v.size())
      |                       ~~~~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 424 KB Output is correct
3 Correct 12 ms 532 KB Output is correct
4 Correct 11 ms 532 KB Output is correct
5 Correct 11 ms 556 KB Output is correct
6 Correct 11 ms 344 KB Output is correct
7 Correct 11 ms 344 KB Output is correct
8 Correct 11 ms 344 KB Output is correct
9 Correct 11 ms 556 KB Output is correct
# 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 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 0 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 1 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 0 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 0 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 0 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 Correct 28 ms 344 KB Output is correct
4 Correct 30 ms 344 KB Output is correct
5 Correct 29 ms 344 KB Output is correct
6 Correct 29 ms 540 KB Output is correct
7 Correct 31 ms 344 KB Output is correct
8 Correct 29 ms 344 KB Output is correct
9 Correct 28 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 424 KB Output is correct
3 Correct 12 ms 532 KB Output is correct
4 Correct 11 ms 532 KB Output is correct
5 Correct 11 ms 556 KB Output is correct
6 Correct 11 ms 344 KB Output is correct
7 Correct 11 ms 344 KB Output is correct
8 Correct 11 ms 344 KB Output is correct
9 Correct 11 ms 556 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 1 ms 344 KB Output is correct
26 Correct 1 ms 344 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 0 ms 344 KB Output is correct
30 Correct 28 ms 344 KB Output is correct
31 Correct 30 ms 344 KB Output is correct
32 Correct 29 ms 344 KB Output is correct
33 Correct 29 ms 540 KB Output is correct
34 Correct 31 ms 344 KB Output is correct
35 Correct 29 ms 344 KB Output is correct
36 Correct 28 ms 344 KB Output is correct
37 Correct 26 ms 344 KB Output is correct
38 Correct 11 ms 344 KB Output is correct
39 Correct 26 ms 556 KB Output is correct
40 Correct 26 ms 344 KB Output is correct
41 Incorrect 26 ms 556 KB Wrong Answer [3]
42 Halted 0 ms 0 KB -