Submission #581389

#TimeUsernameProblemLanguageResultExecution timeMemory
581389jasminGame (IOI14_game)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include<game.h> using namespace std; #define int long long vector<int> chef; vector<int> s; vector<vector<int> > con; int n; int find(int a){ if(chef[a]==a) return a; return chef[a]=find(chef[a]); } void unite(int a, int b){ assert(find(a)!=find(b)); s[find(a)]+=s[find(b)]; for(int i=0; i<n; i++){ if(find(i)!=i) continue; con[find(i)][find(a)]+=con[find(i)][find(b)]; } for(int i=0; i<n; i++){ if(find(i)!=i) continue; con[find(a)][find(i)]+=con[find(b)][find(i)]; } chef[find(b)]=find(a); } void initialize(int32_t a){ n=a; chef.assign(n, 0); iota(chef.begin(), chef.end(), 0); s.assign(n, 1); con.assign(n, vector<int> (n, 0)); } int32_t hasEdge(int32_t u, int32_t v){ assert(find(u)!=find(v)); con[find(u)][find(v)]++; con[find(v)][find(u)]++; //cout << con[find(u)][find(v)] << " " << s[find(u)] << " " << s[find(v)] << "\n"; if(con[find(u)][find(v)]==s[find(u)]*s[find(v)]){ unite(u, v); return 1; } return 0; } /*signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; initialize(n); for(int i=0; i<(n*(n-1))/2; i++){ int a, b; cin >> a >> b; cout << hasEdge(a, b) << "\n" << flush; /*for(int i=0; i<n; i++){ cout << i << " " << find(i) << "\n"; for(int j=0; j<n; j++){ cout << j << " " << find(j) << " " << con[find(i)][find(j)] << "\n"; } } cout << "hallo\n" << flush;*/ } }*/

Compilation message (stderr)

game.cpp:59:9: warning: "/*" within comment [-Wcomment]
   59 |         /*for(int i=0; i<n; i++){
      |          
game.cpp:66:5: error: expected declaration before '}' token
   66 |     }
      |     ^
game.cpp:67:1: error: expected declaration before '}' token
   67 | }*/
      | ^
game.cpp:67:3: error: expected unqualified-id before '/' token
   67 | }*/
      |   ^