Submission #421555

#TimeUsernameProblemLanguageResultExecution timeMemory
421555OttoTheDinoConnecting Supertrees (IOI20_supertrees)C++17
Compilation error
0 ms0 KiB
#include "supertrees.h" #include <bits/stdc++.h> using namespace std; #define rep(i,s,e) for (int i = s; i <= e; ++i) #define rrep(i,s,e) for (int i = s; i >= e; --i) #define pb push_back #define pf push_front #define fi first #define se second #define all(a) a.begin(), a.end() typedef long long ll; typedef pair<int, int> ii; typedef vector<ii> vii; typedef vector<int> vi; typedef vector<double> vd; typedef vector<string> vs; typedef vector<char> vc; typedef vector<ll> vll; int construct (vector<vi> p) { int n = p.size(); int sup[n], tree[n], spec[n]; memset(sup,-1,4*n), memset(tree,-1,4*n); rep (i,0,n-1) { if (sup[i]==-1) { bool two = 0; rep (j,0,n-1) { if (p[i][j]==3) return 0; if (p[i][j]==1 || p[i][j]==2) { if (sup[i]==-1) sup[i] = sup[j] = j; else sup[j] = sup[i]; if (p[i][j]==1) { if (tree[i]==-1) tree[i] = tree[j] = j; else tree[j] = tree[i]; } else two = 1; } else if (i==j) return 0; } spec[sup[i]] = !two; } else if (tree[i]==-1) { rep (j,0,n-1) { if (p[i][j]==3) return 0; if (p[i][j]==1 || p[i][j]==2) { if (p[sup[i]][j] != 1 && p[sup[i]][j] != 2) return 0; if (p[i][j]==1) { if (tree[i]==-1) tree[i] = tree[j] = j; else tree[j] = tree[i]; } } else if (p[sup[i]][j]) return 0; } } else rep (j,0,n-1) if (p[tree[i]][j]!=p[i][j]) return 0; } int b[n][n]={}; rep (i,0,n-1) { if (i==sup[i]) { int last = i; rep (j,0,n-1) { if (i==j) continue; if (j==tree[j]) { if (spec[i]) continue; b[j][last] = b[last][j] = 1; last = j; } else b[j][tree[j]] = b[tree[j]][j] = 1; } if (last!=i && !spec[i]) b[last][i] = b[i][last] = 1; } } build(b); return 1; }

Compilation message (stderr)

supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:78:11: error: could not convert '(int (*)[n])(& b)' from 'int (*)[n]' to 'std::vector<std::vector<int> >'
   78 |     build(b);
      |           ^
      |           |
      |           int (*)[n]