Submission #1057129

#TimeUsernameProblemLanguageResultExecution timeMemory
1057129MrPavlitoCave (IOI13_cave)C++17
Compilation error
0 ms0 KiB
void exploreCave(int N) {
    int n = N;
    int trenutnacomb[n];
    int solved[n];
    int rez[n];
    for(int i=0; i<n; i++)trenutnacomb[i] = 0, solved[i] = 0, rez[i] = 0;
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<n; j++)trenutnacomb[j] = solved[j];
        int t = tryCombination(trenutnacomb);
        int l = 0;
        int r = n-1;
        while(l<r)
        {
            int mid = l+r >> 1;
            for(int j=l; j<= mid; j++)if(!solved[j])trenutnacomb[j] ^= 1;
            int p = tryCombination(trenutnacomb);
            bool pomoc;
            if((p == i && t == i)||(p!=i && t!=i))pomoc = true;
            else pomoc = false;
            if(pomoc)l = mid+1;
            else r = mid;
            t = p;
        }
        solved[l] = i;
        rez[l] = trenutnacomb[l];
        if(p == i)rez[l] = (trenutnacomb[l]^1);
    }
    answer(rez, solved);

}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:10:17: error: 'tryCombination' was not declared in this scope
   10 |         int t = tryCombination(trenutnacomb);
      |                 ^~~~~~~~~~~~~~
cave.cpp:15:24: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   15 |             int mid = l+r >> 1;
      |                       ~^~
cave.cpp:27:12: error: 'p' was not declared in this scope
   27 |         if(p == i)rez[l] = (trenutnacomb[l]^1);
      |            ^
cave.cpp:29:5: error: 'answer' was not declared in this scope
   29 |     answer(rez, solved);
      |     ^~~~~~