제출 #979210

#제출 시각아이디문제언어결과실행 시간메모리
979210rahidilbayramli동굴 (IOI13_cave)C++17
0 / 100
42 ms604 KiB
#include "cave.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define vl vector<ll>
#define vi vector<int>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()
#define pb push_back
#define f first
#define s second
using namespace std;
using namespace __gnu_pbds;
typedef tree<pll, null_type, less<pll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
void exploreCave(int N) {
    int n = N, i, j;
    int isfound[n], f[n], sw[n], fa[n];
    for(i = 0; i < n; i++)
    {
        f[i] = 0;
        isfound[i] = 0;
        sw[i] = 0;
    }
    for(i = 0; i < n; i++)
    {
        int ask = tryCombination(f);
        int ans = n;
        for(j = 0; j < n; j++)
            fa[j] = f[j];
        int l = 0, r = n - 1;
        while(l <= r)
        {
            int mid = (l + r) / 2;
            for(j = l; j <= mid; j++)
            {
                if(!isfound[j])
                    fa[j] = 1 - f[j];
            }
            int res = tryCombination(fa);
            if(res != i && ask != i)
                r = (l + r) / 2 - 1;
            else
                l = (l + r) / 2 + 1;
        }
        isfound[ans] = 1;
        sw[ans] = i;
        if(ask == i)
            f[ans] = 1 - f[ans];
        for(j = 0; j < n; j++)
            f[j] = fa[j];
    }
    answer(f, sw);
}
#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...