제출 #1216697

#제출 시각아이디문제언어결과실행 시간메모리
1216697giorgi123glmCave (IOI13_cave)C++20
0 / 100
84 ms328 KiB
#include "cave.h"
#include <complex.h>
#include <iostream>
#include <mutex>
#include <vector>
using namespace std;

void exploreCave(int N) {
    vector <int> ans (N + 1);
    vector <int> ans1 (N + 1);
    vector <bool> locked (N + 1);

    for (int i = 0; i < N; i++) {
        int curres = tryCombination (ans.data());
        if (curres == i) {
            // try to find correct one
            [&]()->void {
                for (int j = 0; j < N; j++)
                    if (locked[j] == 0) {
                        ans[j] = 1;
                        int getres = tryCombination (ans.data());
                        if (getres > i) {
                            locked[j] = 1;
                            ans1[j] = i;
                            return;
                        } else
                            ans[j] = 0;
                    }
            }();
        } else {
            // try to find incorrect one
            for (int j = 0; j < N; j++)
                if (locked[j] == 0) {
                    ans[j] = 1;
                    int getres = tryCombination (ans.data());
                    if (getres == i) {
                        locked[j] = 1;
                        ans[j] = 0;
                        ans1[j] = i;
                        break;
                    } else
                        ans[j] = 0;
                }
        }
    }

    answer (ans.data(), ans1.data());
}
#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...