Submission #1338427

#TimeUsernameProblemLanguageResultExecution timeMemory
1338427AndreyChameleon's Love (JOI20_chameleon)C++20
0 / 100
21 ms5372 KiB
#include "chameleon.h"
#include <bits/stdc++.h>
using namespace std;

int n;
bool bruh[1001][1001];
int yeah[1001][1001];

void calc(vector<int> wut) {
    if(wut.size() <= 1) {
        return;
    }
    if(wut.size() == 2) {
        if(Query(wut) < 2) {
            bruh[wut[0]][wut[1]] = 1;
            bruh[wut[1]][wut[0]] = 1;
        }
        return;
    }
    vector<int> wow[3];
    for(int i = 0; i < wut.size(); i++) {
        wow[i%3].push_back(wut[i]);
        wow[(i+1)%3].push_back(wut[i]);
    }
    for(int i = 0; i < 3; i++) {
        if(Query(wow[i]) < wow[i].size()) {
            calc(wow[i]);
        }
    }
}

void Solve(int N) {
    n = N;
    vector<int> wut(0);
    for(int i = 1; i <= 2*n; i++) {
        wut.push_back(i);
        for(int j = 1; j <= 2*n; j++) {
            bruh[i][j] = false;
            yeah[i][j] = 0;
        }
    }
    calc(wut);
    for(int i = 1; i <= 2*n; i++) {
        vector<int> yo(0);
        for(int j = 1; j <= 2*n; j++) {
            if(bruh[i][j]) {
                yo.push_back(j);
            }
        }
        if(yo.size() == 1) {
            yeah[i][yo[0]]++;
        }
        else if(yo.size() == 2) {
            cout << "el momento de bruh" << endl;
        }
        else {
            if(Query({yo[0],yo[1],i}) == 1) {
                yeah[i][yo[0]]++;
                yeah[i][yo[1]]++;
            }
            else if(Query({yo[1],yo[2],i}) == 1) {
                yeah[i][yo[1]]++;
                yeah[i][yo[2]]++;
            }
            else {
                yeah[i][yo[0]]++;
                yeah[i][yo[2]]++;
            }
        }
    }
    for(int i = 1; i <= 2*n; i++) {
        for(int j = i+1; j <= 2*n; j++) {
            if(yeah[i][j]+yeah[j][i] >= 2) {
                Answer(i,j);
            }
        }
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...