Submission #212215

# Submission time Handle Problem Language Result Execution time Memory
212215 2020-03-22T13:51:42 Z shahadbalghonaim Chameleon's Love (JOI20_chameleon) C++14
40 / 100
22 ms 416 KB
#include <bits/stdc++.h>
#include "chameleon.h"
//https://cms.ioi-jp.org/tasks/chameleon/descriptionusing namespace std;
using namespace std;

void Solve(int N){
    int n=N*2;
    vector<bool>solved(n+1,0);
    map<int,vector<int>>theval;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            if(i==j){continue;}
            if(Query({i,j})==1){theval[i].push_back(j);}
        }
    }
    map<int,vector<int>>graph;
    int haha=0;
    for(int i=1;i<=n;i++){
     if(solved[i]==1)continue;
     if(theval[i].size()==1){haha++;Answer(i,theval[i][0]);solved[i]=1;solved[theval[i][0]]=1;continue;}
     if(Query({i,theval[i][0],theval[i][1]})==1){graph[i].push_back(theval[i][2]);graph[theval[i][2]].push_back(i);}
     else if(Query({i,theval[i][0],theval[i][2]})==1){graph[i].push_back(theval[i][1]);graph[theval[i][1]].push_back(i);}
     else if(Query({i,theval[i][2],theval[i][1]})==1){graph[i].push_back(theval[i][0]);graph[theval[i][0]].push_back(i);}

    }
    for(int i=1;i<=n;i++){
        if(solved[i]==1){continue;}
        //assert(graph[i].size()<=2);
        int a=graph[i][0],b=graph[i][1];
        for(int j=0;j<3;j++){
            if(theval[i][j]!=a&&theval[i][j]!=b&&solved[theval[i][j]]==0){Answer(i,theval[i][j]);solved[i]=1;solved[theval[i][j]]=1;break;}
        }
    }

}

# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Incorrect 21 ms 384 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
10 Correct 6 ms 384 KB Output is correct
11 Correct 6 ms 384 KB Output is correct
12 Correct 6 ms 384 KB Output is correct
13 Correct 7 ms 384 KB Output is correct
14 Correct 7 ms 384 KB Output is correct
15 Correct 6 ms 384 KB Output is correct
16 Correct 7 ms 384 KB Output is correct
17 Correct 7 ms 384 KB Output is correct
18 Correct 7 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 416 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Incorrect 22 ms 384 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Incorrect 21 ms 384 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -