제출 #237743

#제출 시각아이디문제언어결과실행 시간메모리
237743nicolaalexandra동굴 (IOI13_cave)C++14
46 / 100
17 ms640 KiB
#include <bits/stdc++.h>
#include "cave.h"
#define DIM 5010
using namespace std;

int n,i,ans;
int v[DIM],sol[DIM],f[DIM];
/*
void answer(int s[], int d[]){
    for (int i=0;i<n;i++)
        cout<<s[i]<<" ";
    cout<<"\n";
    for (int i=0;i<n;i++)
        cout<<d[i]<<"\n";
}

int tryCombination (int S[]){
    int ans,i;
    for (i=0;i<n;i++)
        cout<<S[i]<<" ";
    cout<<endl;
    cin>>ans;
    cout<<endl;
    return ans;
}
*/
void exploreCave (int N){

    n = N;
    int poz = tryCombination(v);

    for (;poz != -1;){

        /// incerc sa gasesc switch ul care deschide usa de pe poz

        for (i=0;i<n;i++){
            if (f[i])
                continue;

            v[i] = 1;
            ans = tryCombination(v);

            if (ans > poz || ans == -1){

                sol[i] = poz;
                f[i] = 1;
                if (ans == -1)
                    break;
                poz = ans;
            } else {
                v[i] = 0;
                if (ans < poz){
                    sol[i] = ans;
                    f[i] = 1;
                }}}

        if (ans == -1)
            break;
    }

    for (i=0;i<n;i++){
        if (f[i])
            continue;
        v[i] = 1;
        sol[i] = tryCombination(v);
        v[i] = 0;
    }

    answer(v,sol);

}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…