Submission #318797

# Submission time Handle Problem Language Result Execution time Memory
318797 2020-11-03T08:47:21 Z Wesley_Wang Cave (IOI13_cave) C++14
0 / 100
4 ms 1004 KB
#include "cave.h"
#include <bits/stdc++.h>

using namespace std;

int determine[5000];
int correspond[5000];
vector<int> undone;
int undones;

void exploreCave(int N) {

    for (int i = 0; i < N; i++)
        determine[i] = rand() % 2, correspond[i] = i, undone.push_back(i);

    undones = N;

    while (undones > 0)
    {
        int pivot = tryCombination(determine);
        int pivot_point = 0;

        int r = N;

        for (int i = 0; i <= undones; i++)
        {
            int o = correspond[undone[i]];
            determine[correspond[o]] = !determine[correspond[o]];
            int t = tryCombination(determine);
            if (t != pivot)
            {
                undone.erase(undone.begin() + i), undones--;
                correspond[undone[i]] = t;
                if (t > pivot)
                    pivot_point = i;
            }
            else
                correspond[undone[i]] = r--;
            determine[correspond[o]] = !determine[correspond[o]];
        }
        determine[correspond[pivot_point]] = !determine[correspond[pivot_point]];
    }
    answer(determine, correspond);
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 492 KB too much calls on tryCombination()
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 1004 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 620 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 620 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 492 KB too much calls on tryCombination()
2 Halted 0 ms 0 KB -