제출 #71852

#제출 시각아이디문제언어결과실행 시간메모리
71852yusufake동굴 (IOI13_cave)C++98
100 / 100
908 ms640 KiB
#include<bits/stdc++.h>
using namespace std;
#include "cave.h"
 
int A[5003],T[5003];
vector < int > v;
void exploreCave(int n) {
    /* ... */
    int i,j,t,l,m,r;
    v.clear();
    for(i=0;i<n;i++) v.push_back(i);
    for(i=0;i<n;i++){
        l = 0;
        r = v.size()-1;
        if(tryCombination(T) == i){
            for(; l<r ;){
                m = l+r >> 1;
                for(j=0;j<=m;j++) T[ v[j] ] = 1;
                if((t=tryCombination(T)) > i || t==-1) r = m;
                else l = m+1;
                for(j=0;j<=m;j++) T[ v[j] ] = 0;
            }
            j = v[l];
            A[j] = i;
            T[j] = 1;
        }
        else{
            for(; l<r ;){
                m = l+r >> 1;
                for(j=0;j<=m;j++) T[ v[j] ] = 1;
                if(tryCombination(T) == i) r = m;
                else l = m+1;
                for(j=0;j<=m;j++) T[ v[j] ] = 0;
            }
            j = v[l];
            A[j] = i;
            T[j] = 0;
        }
        v.erase(v.begin() + l);
    }
    answer(T,A);
}

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:17:22: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
                 m = l+r >> 1;
                     ~^~
cave.cpp:29:22: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
                 m = l+r >> 1;
                     ~^~
#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...