Submission #755298

# Submission time Handle Problem Language Result Execution time Memory
755298 2023-06-09T17:31:03 Z Godgift42 Cave (IOI13_cave) C++14
0 / 100
160 ms 372 KB
#include "cave.h"
using namespace std;

void exploreCave(int N) {
    int s[N];
    int d[N];
    int c[N];
    for(int i=0;i<N;i++){
        s[i]=0;
        c[N]=0;
    }
    
    for(int i=0;i<N;i++){
        int e = tryCombination(s);
        if(e<i){
            for(int j=0;j<N;j++){
                if(!c[j]){
                    if(s[j]==0) s[j]++;
                    else s[j]--;
                }
            }
        }
        int l=0;int r=N;
        int pre=1;
        int t;
        while(l<r){
            t=(l+r)/2;
            for(int j=l;j<=t;j++){
                if(!c[j]){
                    if(s[j]==0) s[j]++;
                    else s[j]--;
                }
            }
            e = tryCombination(s);
            if(e==i) e=0;
            else e=1;
            if((e==0 and pre==1) or (e==1 and pre==0)){
                r=t;
                pre=e;
            }
            else{
                l = t+1;
                pre=e;
            }
        }
        d[t]=i;
        c[t]=1;
        if(pre==0){
            if(s[t]==0) s[t]++;
            else s[t]--;
        }
    }

    answer(s,d);
}
# Verdict Execution time Memory Grader output
1 Incorrect 36 ms 340 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 160 ms 372 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Answer is wrong
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Answer is wrong
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 36 ms 340 KB Answer is wrong
2 Halted 0 ms 0 KB -