Submission #303917

#TimeUsernameProblemLanguageResultExecution timeMemory
303917rocks03Cave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
//#include "cave.h" #include<bits/stdc++.h> #define ll long long #define pii pair<int, int> #define pll pair<ll, ll> #define ff first #define ss second #define pb push_back #define SZ(x) ((int) (x).size()) using namespace std; void answer(int S[], int D[]); int tryCombination(int S[]); int recur(int res, int l, int r, vector<int>&v, int ans[]){ if(l == r){ return v[l]; } int m = (l + r) / 2; for(int i = l; i <= m; i++){ ans[v[i]] ^= 1; } int res2 = tryCombination(ans); for(int i = l; i <= m; i++){ ans[v[i]] ^= 1; } if(res != res2){ return recur(res, l, m, v, ans); } else{ return recur(res, m+1, r, v, ans); } } void exploreCave(int N){ int ans[N], d[N]; memset(ans, 0, sizeof(ans)); memset(d, -1, sizeof(d)); while(true){ vector<int> v; for(int i = 0; i < N; i++){ if(d[i] == -1){ v.pb(i); } } if(!SZ(v)) break; int res = tryCombination(ans); if(res == -1) break; int get = recur(res, 0, SZ(v) - 1, v, ans); d[get] = res; ans[get] ^= 1; } 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 (stderr)

/tmp/ccCyWGGQ.o: In function `recur(int, int, int, std::vector<int, std::allocator<int> >&, int*)':
cave.cpp:(.text+0x95): undefined reference to `tryCombination(int*)'
cave.cpp:(.text+0xe1): undefined reference to `tryCombination(int*)'
/tmp/ccCyWGGQ.o: In function `exploreCave(int)':
cave.cpp:(.text+0x207): undefined reference to `tryCombination(int*)'
cave.cpp:(.text+0x287): undefined reference to `answer(int*, int*)'
cave.cpp:(.text+0x2dd): undefined reference to `tryCombination(int*)'
/tmp/ccweDGEO.o: In function `main':
grader.c:(.text.startup+0xc): undefined reference to `exploreCave'
collect2: error: ld returned 1 exit status