제출 #319103

#제출 시각아이디문제언어결과실행 시간메모리
319103Wesley_Wang동굴 (IOI13_cave)C++14
0 / 100
2 ms492 KiB
#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[t] = p;
                if (t > pivot)
                    pivot_point = p;
            }
            else
                correspond[r--] = p;
            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);
}

컴파일 시 표준 에러 (stderr) 메시지

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:32:13: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   32 |             if (t == -1)
      |             ^~
cave.cpp:33:28: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   33 |               flag = true; break;
      |                            ^~~~~
#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...