Submission #318796

# Submission time Handle Problem Language Result Execution time Memory
318796 2020-11-03T08:45:58 Z jerrymonkey Cave (IOI13_cave) C++14
0 / 100
517 ms 612 KB
#include "cave.h"
#include <bits/stdc++.h>

using namespace std;


void exploreCave (int N) {
    int known[N], correctSw[N];
    for (int i = 0; i < N; i++)
		known[i] = -1;

    for (int i = 0; i < N; i++) {
        int segLen = pow(2, __lg(N - i - 1));
		int output[N];
		for (int i = 0; i < N; i++)
			output[i] = known[i];
        int c = 0, pos = 0;
		for (int j = 0; j < N; j++) {
			if (output[j] == -1)
				output[j] = 0;
		}
		bool doorSw = 0;
		if (tryCombination(output) > i)
			doorSw = 0;
		else
			doorSw = 1;
        while (1) {
			for (int j = 0; j < N; j++) {
				if (output[j] == -1) {
					output[j] = ((c / segLen + doorSw) % 2);
					c++;
				}
			}
			if (!(tryCombination(output) > i))
                pos = pos | (1 << __lg(segLen));
			if (segLen == 1)
				break;
			segLen /= 2;
        }

		int k = 0;
        for (int j = 0; j < N; j++) {
            if (known[j] == -1) {
                if (k == pos) {
					known[j] = doorSw;
					correctSw[doorSw] = i;
					break;
                }
                k++;
            }
        }

	}

    answer(known, correctSw);


}
# Verdict Execution time Memory Grader output
1 Incorrect 213 ms 612 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 517 ms 612 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 213 ms 612 KB Answer is wrong
2 Halted 0 ms 0 KB -