제출 #670707

#제출 시각아이디문제언어결과실행 시간메모리
670707birthdaycakeCave (IOI13_cave)C++17
34 / 100
9 ms408 KiB
#include<bits/stdc++.h>
#include "cave.h"
using namespace std;
void exploreCave(int n) {
    int vs[n],val[n],sw[n];
    memset(vs, 0, sizeof vs);
    memset(val, 0, sizeof val);
    memset(sw, 0, sizeof sw);
    
    
    if(n > 100){
        for(int i = 0; i < n; i++){
            val[i] = 1;
            sw[i] = tryCombination(val);
            val[i] = 0;
        }
        answer(val, sw);
        return;
    }
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(!vs[j]){
                val[j] = 0;
            }
        }
        int x = tryCombination(val), what = 0;
        
        
        if(x == i) what = 1;
        
        
        for(int j = 0; j < n; j++){
            if(!vs[j]){
                val[j] = !what;
            }
        }
        for(int j = 0; j < n; j++){
            if(!vs[j]){
                val[j] = what;
                int ii = tryCombination(val);
                if(ii == -1 or ii > i){
                    sw[j] = i;
                    vs[j] = 1;
                    break;
                }
                val[j] = !what;
            }
        }
    }
    answer(val, sw);
}
#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...