Submission #1205283

#TimeUsernameProblemLanguageResultExecution timeMemory
1205283AndreySphinx's Riddle (IOI24_sphinx)C++20
36 / 100
32 ms936 KiB
#include "sphinx.h"
#include<bits/stdc++.h>
using namespace std;

int n;

bool check(int p, int c, vector<int> haha) {
    int np = 1-p;
    vector<int> wow(n,c);
    for(int i = p; i < n; i+=2) {
        wow[i] = n;
    }
    for(int v: haha) {
        wow[v] = -1;
    }
    if(perform_experiment(wow) < n) {
        return true;
    }
    else {
        return false;
    }
}

int dude(int p, int c, vector<int> haha) {
    if(haha.size() == 1) {
        return haha[0];
    }
    vector<int> wow(0);
    vector<int> wut(0);
    for(int i = 0; i < haha.size()/2; i++) {
        wow.push_back(haha[i]);
    }
    for(int i = haha.size()/2; i < haha.size(); i++) {
        wut.push_back(haha[i]);
    }
    if(check(p,c,wow)) {
        return dude(p,c,wow);
    }
    else {
        return dude(p,c,wut);
    }
}

std::vector<int> find_colours(int N, std::vector<int> x, std::vector<int> y) {
    n = N;
    vector<int> ans(n,-1);
    for(int i = 0; i < n; i++) {
        while(true) {
            vector<int> wow(0);
            for(int j = 0; j < n; j+=2) {
                if(ans[j] == -1) {
                    wow.push_back(j);
                }
            }
            if(check(0,i,wow)) {
                ans[dude(0,i,wow)] = i;
            }
            else {
                break;
            }
        }
        while(true) {
            vector<int> wow(0);
            for(int j = 1; j < n; j+=2) {
                if(ans[j] == -1) {
                    wow.push_back(j);
                }
            }
            if(check(1,i,wow)) {
                ans[dude(1,i,wow)] = i;
            }
            else {
                break;
            }
        }
    }
    return ans;
}
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...