Submission #1055586

# Submission time Handle Problem Language Result Execution time Memory
1055586 2024-08-12T23:07:55 Z MrPavlito Cave (IOI13_cave) C++17
Compilation error
0 ms 0 KB
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++)if(solved[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)pomoc = true;
            else if(p != i && t == i)pomoc = false;
            else if(p == i && t !=i) pomoc = false;
            else pomoc = true;
            if(!pomoc)r = mid;
            else l = mid+1;
            t = p;
        }
        solved[l] = i;
        rez[l] = trenutnacomb[l];
        if(t == i)rez[l] = (trenutnacomb[l]^1);
    }
    }
    //for(int i=0; i<n; i++)cout << trenutnacomb[i] << " ";cout <<  endl;
    //for(int i=0; i<n; i++)cout << solved[i] << " ";cout <<  endl;
	anwser(rez, solved);
}

Compilation message

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: At global scope:
cave.cpp:34:8: error: expected constructor, destructor, or type conversion before '(' token
   34 |  anwser(rez, solved);
      |        ^
cave.cpp:35:1: error: expected declaration before '}' token
   35 | }
      | ^