Submission #107079

#TimeUsernameProblemLanguageResultExecution timeMemory
107079stefdascaCave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include "cave.h"
void exploreCave(int N)
{
    int S[N+2], D[N+2];
    memset(S, 0, sizeof(S));
    memset(D, 0, sizeof(D));
    int P[N+2], pus[N+2];
    memset(P, 0, sizeof(P));
    memset(pus, 0, sizeof(pus));
    for(int i = 0; i < n; ++i)
    {
        int st = 0;
        int dr = n-1;
        for(int j = 0; j < n; ++j)
            if(pus[j])
                P[j] = S[j];
            else
                P[j] = 1;
        int ans = tryCombination(P);
        bool ce = 0;
        if(ans > i)
            ce = 1;
        while(st < dr)
        {
            int mid = (st + dr) / 2;
            for(int j = 0; j < n; ++j)
            {
                if(pus[j])
                    P[j] = S[j];
                else
                    if(st <= j && j <= mid)
                        P[j] = ce;
                    else
                        P[j] = ce ^ 1;
            }
            ans = tryCombination(P);
            if(ans > i)
                dr = mid;
            else
                st = mid + 1;
        }
        pus[st] = 1;
        S[st] = i;
        D[st] = ce;
    }
    answer(S, D);
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:5:5: error: 'memset' was not declared in this scope
     memset(S, 0, sizeof(S));
     ^~~~~~
cave.cpp:10:24: error: 'n' was not declared in this scope
     for(int i = 0; i < n; ++i)
                        ^