제출 #371616

#제출 시각아이디문제언어결과실행 시간메모리
371616Lam_lai_cuoc_doiPainting Squares (IOI20_squares)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; const int N = 1e3 + 5; map<int, int> ck; int a[N], m, s, ans; bool dfs(int v, int dep) { ck[v] = dep; if (dep == 971) return true; int u = v >> 1; if (!ck[u + (1 << 29)]) if (dfs(u + (1 << 29), dep + 1)) return true; if (!ck[u]) if (dfs(u, dep + 1)) return true; return false; } void fillout(int v, int dep) { if (dep > m - 30 + 1) return; if (s == v) { ans = dep - 1; return; } int u = v >> 1; if (ck[u] == dep + 1) fillout(u, dep + 1); else if (ck[u + (1 << 29)] == dep + 1) fillout(u + (1 << 29), dep + 1); } void fillin(int v, int dep) { if (dep == m - 30 + 1) { for (int i = 0; i < 30; ++i) a[m - 30 + 1 + i] = (v >> i) & 1; return; } a[dep - 1] = v & 1; int u = v >> 1; if (ck[u] == dep + 1) fillin(u, dep + 1); else if (ck[u + (1 << 29)] == dep + 1) fillin(u + (1 << 29), dep + 1); } int *paint(int n) { if (n <= 30) { for (int i = 0; i < n; ++i) a[i] = 1; a[n] = n; return a; } m = n; ck.clear(); ck[1] = 1; dfs(1, 1); fillin(1, 1); return a; } int find_location(int n, int c[]) { if (n <= 30) { for (int i = 0; i < n; ++i) if (c[i] != 1) return -1; return 0; } m = n; ck.clear(); ck[1] = 1; dfs(1, 1); s = 0; for (int i = 0; i < 30; ++i) s += (a[i]) * (1 << i); ans = -1; fillout(1, 1); return ans; }

컴파일 시 표준 에러 (stderr) 메시지

/usr/bin/ld: /tmp/ccPL2jOw.o: in function `main':
stub.cpp:(.text.startup+0x420): undefined reference to `find_location(int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status