제출 #648937

#제출 시각아이디문제언어결과실행 시간메모리
648937tigar동굴 (IOI13_cave)C++14
0 / 100
331 ms400 KiB
#include <bits/stdc++.h>
#include "cave.h"

using namespace std;

bool check[5050];
int combs[5050], doors[5050];

void exploreCave(int n)
{
    for(int br=0; br<n; br++)
    {
        for(int i=0; i<n; i++)
            if(!check[i])combs[i]=0;
        int beg=tryCombination(combs), opening=1;
        if(beg>br or beg==-1)opening=0;
        int l=0, r=n, midd=n/2;
        while(r-l>1)
        {
            for(int i=0; i<n; i++)
                if(!check[i])
                    if(i<l or i>midd)combs[i]=abs(opening-1);
                    else combs[i]=opening;
            int begg=tryCombination(combs);
            if(begg>br or begg==-1){r=midd; midd=(l+r)/2;}
            else {l=midd; midd=(l+r)/2;}
        }
        if(l==r){check[l]=true; doors[l]=br; combs[l]=opening;}
        else
        {
            combs[l]=opening; combs[r]=abs(opening-1);
            int xx=tryCombination(combs);
            if(xx>br or xx==-1){check[l]=true; doors[l]=br; combs[l]=opening;}
            else {check[r]=true; doors[r]=br; combs[r]=opening;}
        }
    }
    return answer(combs, doors);
}

컴파일 시 표준 에러 (stderr) 메시지

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:21:19: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
   21 |                 if(!check[i])
      |                   ^
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…