Submission #1357537

#TimeUsernameProblemLanguageResultExecution timeMemory
1357537Charizard2021Cave (IOI13_cave)C++20
Compilation error
0 ms0 KiB
#include "cave.h"
#include<bits/stdc++.h>
using namespace std;
void exploreCave(int n){
    vector<int> correspondence(1 + n, -1);
    vector<int> switchNeed(1 + n, -1);
    for(int i = 0; i < n; i++){
        int s[n];
        for(int j = 0; j < n; j++){
            s[j] = 0;
        }
        for(int j = 0; j < i; j++){
            s[correspondence[j]] = switchNeed[j];
        }
        if(tryCombination(s) == i){
            switchNeed[i] = 1;
        }
        else{
            switchNeed[i] = 0;
        }
        int low = 0;
        int high = n - 1;
        int res = -1;
        while(low < high){
            int mid = (low + high)/2;
            int s2[n];
            for(int j = 0; j < n; j++){
                s2[j] = 1 - switchNeed[i];
            }
            for(int j = low; j <= mid; j++){
                s2[j] = switchNeed[i];
            }
            for(int j = 0; j < i; j++){
                s2[correspondence[j]] = switchNeed[j];
            }
            if(tryCombination(s2) == i){
                low = mid + 1;
            }
            else{
                high = mid;
            }
        }
        correspondence[i] = low;
    }
    answer(finalS, d);
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:45:12: error: 'finalS' was not declared in this scope
   45 |     answer(finalS, d);
      |            ^~~~~~
cave.cpp:45:20: error: 'd' was not declared in this scope
   45 |     answer(finalS, d);
      |                    ^