Submission #1317055

#TimeUsernameProblemLanguageResultExecution timeMemory
1317055tsetsenbilegCave (IOI13_cave)C++20
0 / 100
206 ms584 KiB
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pr pair<int, int>
#define tri array<int, 3>
const int INF = 1e9 + 7;
int n;

void exploreCave(int N) {
    n = N;
    int pos[n], color[n], cur[n];
    for (int i = 0; i < n; i++) {
        pos[i] = 0; color[i] = 0; cur[i] = 0;
    }
    vector<bool> found(n, 0);
    for (int i = 0; i < n; i++) {
        int c;
        int ttt = tryCombination(cur);
        if (ttt > i || ttt == -1) c = 0;
        else c = 1;
        color[i] = c;
        vector<int> idk;
        for (int j = 0; j < n; j++) {
            if (found[j]) idk.pb(j);
        }
        int l = 0, r = idk.size(), m;
        while (l + 1 < r) {
            m = (l + r) / 2;
            int temp[n];
            for (int j = 0; j < n; j++) {
                temp[j] = cur[j];
            }
            for (int j = l; j < m; j++) {
                temp[found[j]] = c;
            }
            int t = tryCombination(temp);
            if (t > i || t == -1) r = m;
            else l = m;
        }
        found[i] = 1;
        pos[i] = l;
        cur[l] = c;
    }

}
#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...