Submission #576103

#TimeUsernameProblemLanguageResultExecution timeMemory
576103MadokaMagicaFanCarnival Tickets (IOI20_tickets)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using pi = pair<int,int>; #define all(v) v.begin(),v.end() #define sort(v) sort(all(v)) #define endl '\n' #define forn(i,n) for(int i = 0; i < n; ++i) #define forbe(i,b,e) for(int i = b; i < e; ++i) #define forr(i,n) for(int i = n-1; i >= 0; --i) #define sz(v) ((int)v.size()) #define pb push_back #define f first #define s second void build(vector<vi> b); const int N = 1e3; int par[N]; int lst[N]; vi adj[N]; int getp(int x) { return par[x] = (par[x] == x ? x : getp(par[x])); } int getl(int x) { return lst[x] = (lst[x] == x ? x : getl(lst[x])); } int uni(int a, int b) { a = getp(a); b = getp(b); if (a == b) return 0; adj[a].pb(getl(b)); adj[getl(b)].pb(a); par[a] = b; lst[getl(b)] = getl(a); lst[b] = getl(a); return 1; } int construct(vector<vi> p) { int n = sz(p); bool t0, t1, t2; t0 = t1 = t2 = 0; int task = 0; forn(i,n) { forn(j,n) { if (p[i][j] == 0) t0 = 1; if (p[i][j] == 1) t1 = 1; if (p[i][j] == 2) t2 = 1; } } if (t1 && !t2) task = 1; if (t2 && !t1) task = 2; if (t2 && t1) task = 3; forn(i,n) par[i] = i; forn(i,n) lst[i] = i; forn(i,n) { forn(j,n) { if (i == j) continue; if (p[i][j]) uni(i,j); } } forn(i,n) { forn(j,n) { if (i == j) continue; if (p[i][j] == 0 && getp(i) == getp(j)) return 0; } } vector<vi> ans(n); forn(i,n) ans[i].assign(n,0); if (task == 2) { forn (i, n) { if (getp(i) != i) continue; adj[i].pb(getl(i)); } } forn (i,n) { for (int u : adj[i]) ans[i][u] = 1; } build(ans); return 1; } #ifdef ONPC void build(vector<vi> b) { } void solve() { } int main() { // freopen("in", "r", stdin); // ios_base::sync_with_stdio(0);cin.tie(0); solve(); } #endif

Compilation message (stderr)

tickets.cpp: In function 'int construct(std::vector<std::vector<int> >)':
tickets.cpp:48:10: warning: variable 't0' set but not used [-Wunused-but-set-variable]
   48 |     bool t0, t1, t2;
      |          ^~
/usr/bin/ld: /tmp/ccMEM0Gk.o: in function `construct(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)':
tickets.cpp:(.text+0x8f8): undefined reference to `build(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)'
/usr/bin/ld: /tmp/ccLPbPzk.o: in function `main':
grader.cpp:(.text.startup+0x387): undefined reference to `find_maximum(int, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)'
collect2: error: ld returned 1 exit status