답안 #319107

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
319107 2020-11-04T00:54:55 Z Wesley_Wang 동굴 (IOI13_cave) C++14
0 / 100
6 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;
 		if (pivot == -1)
              break;
        bool flag = false;
        for (int p : undone)
        {
            int o = correspond[p];
            determine[correspond[o]] = !determine[correspond[o]];
            int t = tryCombination(determine);
            if (t == -1)
            {
              flag = true; 
              break;
            }
            if (t != pivot)
            {
                undone.erase(undone.begin() + p), undones--;
                correspond[p] = t;
                if (t > pivot)
                    pivot_point = p;
            }
            else
                correspond[p] = --r;
            determine[correspond[o]] = !determine[correspond[o]];
        }
      	if (flag)
          break;
        determine[correspond[pivot_point]] = !determine[correspond[pivot_point]];
    }
  	while (undones > 0)
    {
      	int o = correspond[undone[0]];
        determine[correspond[o]] = !determine[correspond[o]];
      	int t = tryCombination(determine);
      	correspond[undone[0]] = t, undone.erase(undone.begin()), undones--;
      	determine[correspond[o]] = !determine[correspond[o]];
    }
    answer(determine, correspond);
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 748 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 1004 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 1 ms 364 KB Answer is wrong
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 1 ms 364 KB Answer is wrong
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 748 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -