Submission #99269

#TimeUsernameProblemLanguageResultExecution timeMemory
99269long10024070Cave (IOI13_cave)C++11
Compilation error
0 ms0 KiB
#include "cave.h"

void Fill(int l, int r, bool d)
{
    for (int i=l;i<=r;++i)
        if (Val[i] != -1)
            s[i] = True[i];
        else
            s[i] = d;
}

void exploreCave(int n)
{
    fill(Val,Val+n,-1);
    for (int i=0;i<n;++i) {
        Fill(0,n-1,0);
        bool fl = (i == tryCombination(s));
//        cout << "    ";
//        for (int i=0;i<n;++i)
//            cout << s[i] << ' ';
//        cout << '\n';
//        cout << i <<  ' ' << fl << ' ' << tryCombination(s) << '\n';
        int l = 0;
        int r = n - 1;
        while (l <= r) {
            int m = (l + r) / 2;
            Fill(1,n-1,fl^1);
            Fill(l,m,fl);
            Fill(m+1,r,fl^1);
//            cout << "    ";
//            for (int i=0;i<n;++i)
//                cout << s[i] << ' ';
//            cout << '\n';
//            cout << i << ' ' << l << ' ' << r << ' ' << m << ' ' << tryCombination(s) << '\n';
            if (tryCombination(s) == i)
                l = m + 1;
            else
                r = m - 1;
        }
//        cout << l << ' ' << fl << '\n';
        True[l] = fl;
        Val[l] = i;
    }
    answer(True,Val);
}

Compilation message (stderr)

cave.cpp: In function 'void Fill(int, int, bool)':
cave.cpp:6:13: error: 'Val' was not declared in this scope
         if (Val[i] != -1)
             ^~~
cave.cpp:7:13: error: 's' was not declared in this scope
             s[i] = True[i];
             ^
cave.cpp:7:20: error: 'True' was not declared in this scope
             s[i] = True[i];
                    ^~~~
cave.cpp:9:13: error: 's' was not declared in this scope
             s[i] = d;
             ^
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:14:10: error: 'Val' was not declared in this scope
     fill(Val,Val+n,-1);
          ^~~
cave.cpp:14:5: error: 'fill' was not declared in this scope
     fill(Val,Val+n,-1);
     ^~~~
cave.cpp:14:5: note: suggested alternative: 'Fill'
     fill(Val,Val+n,-1);
     ^~~~
     Fill
cave.cpp:17:40: error: 's' was not declared in this scope
         bool fl = (i == tryCombination(s));
                                        ^
cave.cpp:41:9: error: 'True' was not declared in this scope
         True[l] = fl;
         ^~~~
cave.cpp:44:12: error: 'True' was not declared in this scope
     answer(True,Val);
            ^~~~