제출 #782237

#제출 시각아이디문제언어결과실행 시간메모리
782237Minindu206Cave (IOI13_cave)C++14
0 / 100
37 ms440 KiB
#include "cave.h"
#include<bits/stdc++.h>
using namespace std;
void exploreCave(int n) { 
    int sw[n], st[n], temp[n];
    for(int i=0;i<n;i++)
        st[i] = 0, sw[i] = -1;
    int cc = tryCombination(st);
    if(cc == -1)
    {
        for(int i=0;i<n;i++)
        {
            temp[i] = 1;
            cc = tryCombination(temp);
            sw[i] = cc;
        }
        answer(st, sw);
        return;
    }
    for(int i=0;i<n;i++)
    {
        
        int cmb = tryCombination(st), swt = 1;
        if(cmb == -1)
            cmb = n;
        if(cmb > i || cmb == -1)
            swt = 0;
        memset(temp, 1 - swt, sizeof(temp));
        for(int j=0;j<n;j++)
        {
            if(sw[j] != -1)
                temp[j] = st[j];
        }
        for(int j=0;j<n;j++)
        {
            if(sw[j] != -1)
                continue;
            temp[j] = swt;
            cmb = tryCombination(temp);
            if(cmb > i || cmb == -1)
            {
                sw[j] = i;
                st[j] = swt;
                break;
            }
            temp[j] = 1 - temp[j];
        }
    }
    answer(st, 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...