Submission #357940

#TimeUsernameProblemLanguageResultExecution timeMemory
357940ryanseeConnecting Supertrees (IOI20_supertrees)C++14
Compilation error
0 ms0 KiB
#include "supertrees.h" #include "bits/stdc++.h" using namespace std; #define FAST ios_base::sync_with_stdio(false); cin.tie(0); #define pb push_back #define eb emplace_back #define ins insert #define f first #define s second #define cbr cerr<<"hi\n" #define mmst(x, v) memset((x), v, sizeof ((x))) #define siz(x) ll(x.size()) #define all(x) (x).begin(), (x).end() #define lbd(x,y) (lower_bound(all(x),y)-x.begin()) #define ubd(x,y) (upper_bound(all(x),y)-x.begin()) mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); //can be used by calling rng() or shuffle(A, A+n, rng) inline long long rand(long long x, long long y) { return rng() % (y+1-x) + x; } //inclusivesss string inline to_string(char c) {string s(1,c);return s;} template<typename T> inline T gcd(T a,T b){ return a==0?llabs(b):gcd(b%a,a); } using ll=long long; using ld=long double; #define FOR(i,s,e) for(ll i=s;i<=ll(e);++i) #define DEC(i,s,e) for(ll i=s;i>=ll(e);--i) using pi=pair<ll,ll>; using spi=pair<ll,pi>; using dpi=pair<pi,pi>; long long LLINF = 1e18; int INF = 1e9+1e6; #define MAXN (1006) int p[MAXN]; void init() { FOR(i,0,MAXN-1) p[i]=i; } int find(int x) { return p[x] == x ? x : p[x] = find(p[x]); } void merge(int x,int y) { p[find(x)] = find(y); } vector<vector<int>> v; void add(int x,int y) { v[x][y]=v[y][x]=1; } int construct(std::vector<std::vector<int>> p) { int n = p.size(); v.resize(n, vector<int>(n, 0)); init(); FOR(i,0,n-1) FOR(j,i+1,n-1) if(p[i][j]) merge(i, j); FOR(i,0,n-1) FOR(j,i+1,n-1) if(p[i][j]==0 && find(i)==find(j)) return 0; vector<vector<int>> nodes; FOR(i,0,n-1) if(find(i) == i) { nodes.pb({}); FOR(j,0,n-1) if(find(j) == find(i)) { nodes.back().eb(j); } } init(); for(auto i:nodes) { for(auto j:i) for(auto k:i) if(j^k && p[j][k] == 1) merge(j, k); for(auto j:i) for(auto k:i) if(j^k && p[j][k] == 2 && find(j)==find(k)) return 0; for(auto j:i) for(auto k:i) if(p[j][k] == 3) {          return 0;       } vector<int> tmp; for(auto j:i) if(find(j)==j) tmp.eb(j); if(siz(tmp) == 2) return 0; if(siz(tmp) > 1) FOR(i,0,siz(tmp)-1) add(tmp[i], tmp[(i+1)%siz(tmp)]); for(auto j:i) if(find(j) ^ j) add(find(j), j); } build(v); return 1; }

Compilation message (stderr)

supertrees.cpp:63:2: error: stray '\302' in program
   63 |           return 0;
      |  ^
supertrees.cpp:63:3: error: stray '\240' in program
   63 |           return 0;
      |   ^
supertrees.cpp:63:5: error: stray '\302' in program
   63 |           return 0;
      |     ^
supertrees.cpp:63:6: error: stray '\240' in program
   63 |           return 0;
      |      ^
supertrees.cpp:63:8: error: stray '\302' in program
   63 |           return 0;
      |        ^
supertrees.cpp:63:9: error: stray '\240' in program
   63 |           return 0;
      |         ^
supertrees.cpp:63:11: error: stray '\302' in program
   63 |           return 0;
      |           ^
supertrees.cpp:63:12: error: stray '\240' in program
   63 |           return 0;
      |            ^
supertrees.cpp:63:14: error: stray '\302' in program
   63 |           return 0;
      |              ^
supertrees.cpp:63:15: error: stray '\240' in program
   63 |           return 0;
      |               ^
supertrees.cpp:64:2: error: stray '\302' in program
   64 |         }
      |  ^
supertrees.cpp:64:3: error: stray '\240' in program
   64 |         }
      |   ^
supertrees.cpp:64:6: error: stray '\302' in program
   64 |         }
      |      ^
supertrees.cpp:64:7: error: stray '\240' in program
   64 |         }
      |       ^
supertrees.cpp:64:9: error: stray '\302' in program
   64 |         }
      |         ^
supertrees.cpp:64:10: error: stray '\240' in program
   64 |         }
      |          ^