제출 #771226

#제출 시각아이디문제언어결과실행 시간메모리
771226Tymond동굴 (IOI13_cave)C++17
46 / 100
24 ms468 KiB
#include "cave.h"
#include <bits/stdc++.h>

void exploreCave(int n) {
    int S[n];
    int D[n];
    
    for(int i = 0; i <= n - 1; i++){
        S[i] = 0;
    }
    
    for(int  i = 0; i <= n - 1; i++){
        int kture = tryCombination(S);
        if(kture > i || kture == -1){
            continue;
        }
        if(S[i] == 0){
                S[i] = 1;
                kture = tryCombination(S);
                //std::cout << kture << ' ' << i << ' ' << j << '\n';
                if(kture > i || kture == -1){
                    continue;
                }
                S[i] = 0;
            }else{
                S[i] = 0;
                kture = tryCombination(S);
                //std::cout << kture << ' ' << i << ' ' << j << '\n';
                if(kture > i || kture == -1){
                    continue;
                }
                S[i] = 1;
            }
        
        for(int j  = 0; j <= n - 1; j++){
            if(S[j] == 0){
                S[j] = 1;
                kture = tryCombination(S);
                //std::cout << kture << ' ' << i << ' ' << j << '\n';
                if(kture > i || kture == -1){
                    break;
                }
                S[j] = 0;
            }else{
                S[j] = 0;
                kture = tryCombination(S);
                //std::cout << kture << ' ' << i << ' ' << j << '\n';
                if(kture > i || kture == -1){
                    break;
                }
                S[j] = 1;
            }
        }
    }
    
    for(int i = 0; i <= n - 1; i++){
        if(S[i] == 0){
            S[i] = 1;
            int kture = tryCombination(S);
            D[i] = kture;
            S[i] = 0;
        }else{
            S[i] = 0;
            int kture = tryCombination(S);
            D[i] = kture;
            S[i] = 1;
        }
    }
    
    answer(S, D);
}
#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...