Submission #985340

# Submission time Handle Problem Language Result Execution time Memory
985340 2024-05-17T15:55:41 Z user736482 Cave (IOI13_cave) C++17
0 / 100
61 ms 520 KB
#include<bits/stdc++.h>
#include<cave.h>
using namespace std;
int result[5002],match[5002],sent[5002];
bool iflastopen,fixed_[5002];
int N;
void change(int a, int b, bool c){
    for(int i=a;i<=b;i++){
        if(!fixed_[i])
            sent[i]= c;
    }
}
 
void exploreCave(int n){
    N = n;
    for(int j=0;j<n;j++){
        change(0,n-1,0);
        int p=tryCombination(sent);
        if(!(p==j))
            iflastopen=0;
        else
            iflastopen=1;
        int pocz=0;
        int kon=n-1;
        while(pocz!=kon){
            int sr=(pocz+kon)/2;
            change(pocz,sr,iflastopen);
            change(sr+1,kon,!iflastopen);
            int ak=tryCombination(sent);
            if(!(p==j))
            {
                kon=sr;
            }
            else{
                pocz=sr+1;
            }
        }
        sent[pocz] = iflastopen;
        match[j]=pocz;
        fixed_[pocz]=1;
    }
    answer(sent,match);
}

Compilation message

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:29:17: warning: unused variable 'ak' [-Wunused-variable]
   29 |             int ak=tryCombination(sent);
      |                 ^~
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 348 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 61 ms 520 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 348 KB Answer is wrong
2 Halted 0 ms 0 KB -