Submission #59270

#TimeUsernameProblemLanguageResultExecution timeMemory
59270muradeynCave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
//#include "cave.h"
#include <bits/stdc++.h>
#define SIZE 5001
using namespace std;

int connect[SIZE];

bool fxd[SIZE];

int comb[SIZE];

void b_search(int i,int l,int r) {
    int curr = tryCombination(comb) , nxt;
    if (curr != -1 && curr < i) curr = 0;
    else curr = 1;
    if (l == r) {
        connect[l] = i;
        if (curr == 0)S[l] = 1 - comb[l];
        else S[l] = comb[l];
        fxd[l] = true;
        return;
    }
    int m = (l + r) >> 1;
    for (int i = l;i<=m;i++)
        if (fxd[i] == false) comb[i] = 1 - comb[i];
    nxt = tryCombination(comb);
    if (nxt != -1 && nxt < i) nxt = 0;
    else nxt = 1;
    if (nxt != curr) b_search(i,l,m);
    else b_search(i,m + 1,r);
}

void exploreCave()
{
    for (int i = 1;i<=n;i++) {
        for (int j = 1;j<=n;j++)
            if (fxd[j] == false)comb[j] = 1;
        b_search(i,1,n);
    }
    for (int i = 1;i<=n;i++) cout<<connect[i]<<" ";
    cout<<endl;
    for (int i = 1;i<=n;i++) cout<<comb[i]<<" ";
    cout<<endl;
    return 0;
}

Compilation message (stderr)

cave.cpp: In function 'void b_search(int, int, int)':
cave.cpp:13:16: error: 'tryCombination' was not declared in this scope
     int curr = tryCombination(comb) , nxt;
                ^~~~~~~~~~~~~~
cave.cpp:18:23: error: 'S' was not declared in this scope
         if (curr == 0)S[l] = 1 - comb[l];
                       ^
cave.cpp:19:14: error: 'S' was not declared in this scope
         else S[l] = comb[l];
              ^
cave.cpp:26:5: error: 'nxt' was not declared in this scope
     nxt = tryCombination(comb);
     ^~~
cave.cpp: In function 'void exploreCave()':
cave.cpp:35:23: error: 'n' was not declared in this scope
     for (int i = 1;i<=n;i++) {
                       ^
cave.cpp:40:23: error: 'n' was not declared in this scope
     for (int i = 1;i<=n;i++) cout<<connect[i]<<" ";
                       ^
cave.cpp:42:23: error: 'n' was not declared in this scope
     for (int i = 1;i<=n;i++) cout<<comb[i]<<" ";
                       ^
cave.cpp:44:12: error: return-statement with a value, in function returning 'void' [-fpermissive]
     return 0;
            ^