Submission #303887

# Submission time Handle Problem Language Result Execution time Memory
303887 2020-09-20T17:59:44 Z rocks03 Cave (IOI13_cave) C++14
Compilation error
0 ms 0 KB
//#include "cave.h"
#include<bits/stdc++.h>
using namespace std;

void answer(int S[], int D[]);
int tryCombination(int S[]);

void exploreCave(int N){
    int ans[N], d[N];
    memset(ans, 0, sizeof(ans));
    memset(d, -1, sizeof(d));
    vector<int> mn(N, 0);
    int res = tryCombination(ans);
    while(res != -1){
        for(int j = 0; j < N; j++){
            if(d[j] != -1 || mn[j] > res){
                continue;
            }
            ans[j] ^= 1;
            int res2 = tryCombination(ans);
            if(res2 == -1 || res2 > res){
                d[j] = res;
                res = res2;
                break;
            } else{
                mn[j] = max(mn[j], res);
                ans[j] ^= 1;
                continue;
            }
        }
        if(res == -1){
            for(int i = 0; i < N; i++){
                if(d[i] == -1){
                    ans[i] ^= 1;
                    res = tryCombination(ans);
                    break;
                }
            }
        }
    }
    for(int i = 0; i < N; i++){
        if(d[i] == -1){
            ans[i] ^= 1;
            d[i] = tryCombination(ans);
            ans[i] ^= 1;
        }
    }
    answer(ans, d);
}

Compilation message

/tmp/ccbsTa0u.o: In function `exploreCave(int)':
cave.cpp:(.text+0xab): undefined reference to `tryCombination(int*)'
cave.cpp:(.text+0xe2): undefined reference to `tryCombination(int*)'
cave.cpp:(.text+0x16f): undefined reference to `tryCombination(int*)'
cave.cpp:(.text+0x1a4): undefined reference to `tryCombination(int*)'
cave.cpp:(.text+0x1c7): undefined reference to `answer(int*, int*)'
/tmp/ccrehlKp.o: In function `main':
grader.c:(.text.startup+0xc): undefined reference to `exploreCave'
collect2: error: ld returned 1 exit status