Submission #1313385

#TimeUsernameProblemLanguageResultExecution timeMemory
1313385shirokitoCave (IOI13_cave)C++20
Compilation error
0 ms0 KiB
#ifndef LOCAL
    #include "cave.h"
#endif

#include <bits/stdc++.h>
using namespace std;

#define all(a) (a).begin(), (a).end()
#define fi first
#define se second

using ll = long long;

const int N = 5000 + 24;

int tryCombination(vector<int> S);
void answer(vector<int> S, vector<int> D);

void exploreCave(int N) {
    int n = N;

    vector<int> state(n, 0), can(n, 1);

    for (int i = 0; i < n; i++) {
        int k = tryCombination(state);
        int m = tryCombination(can);

        if (m != -1 && m < k) {
            int pos = -1;

            for (int l = 0, r = n - 1; l <= r; ) {
                int mid = (l + r) >> 1;

                vector<int> new_state = state;

                for (int i = 0; i <= mid; i++) {
                    if (can[i]) new_state[i] = 1;
                }

                int jury_ans = tryCombination(new_state);

                if (jury_ans != -1 &&  jury_ans < k) {
                    pos = mid;
                    r = mid - 1;
                }
                else l = mid + 1;
            }

            if (pos != -1) {
                can[pos] = 0;
                // cout << "POS = " << pos << "\n";
            }
        }

        else {
            int pos = -1;
        
            for (int l = 0, r = n - 1; l <= r; ) {
                int mid = (l + r) >> 1;

                vector<int> new_state = state;

                for (int i = 0; i <= mid; i++) {
                    if (can[i]) new_state[i] = 1;
                }

                int jury_ans = tryCombination(new_state);

                if (jury_ans == -1 || jury_ans > k) {
                    pos = mid;
                    r = mid - 1;
                }
                else l = mid + 1;  
            }

            if (pos != -1) {
                // cout << "POS = " << pos << "\n";
                state[pos] = 1;
            }
        }
    }

    vector<int> d(n);

    for (int i = 0; i < n; i++) {
        vector<int> new_state = state;
        new_state[i] ^= 1;
        d[i] = tryCombination(new_state);
    }

    return answer(state, d);
}

Compilation message (stderr)

/usr/bin/ld: /tmp/cckVGf7F.o: in function `exploreCave':
cave.cpp:(.text+0x16e): undefined reference to `tryCombination(std::vector<int, std::allocator<int> >)'
/usr/bin/ld: cave.cpp:(.text+0x1ed): undefined reference to `tryCombination(std::vector<int, std::allocator<int> >)'
/usr/bin/ld: cave.cpp:(.text+0x32d): undefined reference to `tryCombination(std::vector<int, std::allocator<int> >)'
/usr/bin/ld: cave.cpp:(.text+0x4b5): undefined reference to `tryCombination(std::vector<int, std::allocator<int> >)'
/usr/bin/ld: cave.cpp:(.text+0x793): undefined reference to `tryCombination(std::vector<int, std::allocator<int> >)'
/usr/bin/ld: cave.cpp:(.text+0x8b3): undefined reference to `answer(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status