답안 #757221

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
757221 2023-06-12T19:28:41 Z KALARRY 동굴 (IOI13_cave) C++14
0 / 100
1 ms 340 KB
//chockolateman

#include "cave.h"
#include<bits/stdc++.h>

using namespace std;

void exploreCave(int N)
{
    int seq[N+5];
    int ans[N+5];
    for(int i =0 ; i < N ; i++)
        seq[i] = 0;
    bool used[N+5];
    for(int i = 0  ; i < N ; i++)
        used[i] = false;
    for(int i = 0 ; i < N ; i++)
    {
        int res = tryCombination(seq);
        if(res>i||res==-1)
        {
            for(int i = 0 ; i < N ; i++)
                if(!used[i])
                {
                    if(seq[i])
                        seq[i] = 0;
                    else
                        seq[i] = 1;
                }            
        }
        int low = 0;
        int high  = N-1;
        while(high > low)
        {
            int mid = (low+high)/2;
            for(int i = 0 ; i <= mid; i++)
            {
                if(seq[i])
                    seq[i] = 0;
                else
                    seq[i] = 1;
            }
            res = tryCombination(seq);
            if(res>i||res==-1)
                high = mid;
            else
                low = mid;
            for(int i = 0 ; i <= mid; i++)
            {
                if(seq[i])
                    seq[i] = 0;
                else
                    seq[i] = 1;
            }
        }
        if(seq[low])
            seq[low] = 0;
        else
            seq[low] = 1;
        used[low] = true;
        ans[i] = low;
        answer(seq,ans);
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Answer is wrong
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Answer is wrong
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 304 KB Answer is wrong
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 304 KB Answer is wrong
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Answer is wrong
2 Halted 0 ms 0 KB -