Submission #1287985

#TimeUsernameProblemLanguageResultExecution timeMemory
1287985eri16Cave (IOI13_cave)C++20
Compilation error
0 ms0 KiB
void exploreCave(int n){
    
    int d[n],v[n],fnd[n];
    
    for (int i=0; i<n; i++){
        v[i]=0;
        fnd[i]=0;
    }

    int ans,cr1,cr2;
    
    queue <int> q;
    
    int tt=0;
    int fns=0;
    
    cr1=tryCombination(v);
    
    for (int i=0; i<n; i++){
    
        int l=0;
        int r=n-1;
        while(l!=r){
        int md=(l+r)/2;
        for(int i=l; i<=md; i++){if(fnd[i]==0){v[i]=1-v[i];}}        
        
        cr2=tryCombination(v);
        
        if ((cr2!=i && cr1!=i) || cr2==cr1){l=min(r,md+1);}
        else{r=md;}
        cr1=cr2;
        }
        if (cr1==i){v[i]=1-v[i];}
        
        fnd[i]=1;
        d[l]=i;
        
        cr2=tryCombination(v);
        
    }

    answer(v,d);
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:12:5: error: 'queue' was not declared in this scope
   12 |     queue <int> q;
      |     ^~~~~
cave.cpp:12:12: error: expected primary-expression before 'int'
   12 |     queue <int> q;
      |            ^~~
cave.cpp:17:9: error: 'tryCombination' was not declared in this scope
   17 |     cr1=tryCombination(v);
      |         ^~~~~~~~~~~~~~
cave.cpp:29:47: error: 'min' was not declared in this scope
   29 |         if ((cr2!=i && cr1!=i) || cr2==cr1){l=min(r,md+1);}
      |                                               ^~~
cave.cpp:42:5: error: 'answer' was not declared in this scope
   42 |     answer(v,d);
      |     ^~~~~~