Submission #1023543

#TimeUsernameProblemLanguageResultExecution timeMemory
1023543Rolo678Stone Arranging 2 (JOI23_ho_t1)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; vector<int>a(2e5+5); map<int,int>m; vector<int>p(2e5+5); vector<int>s(2e5+5); void make_set(int n) { for(int i = 1;i<=n;i++) { p[i] = i; s[i] =1; } } int find_parent (int v) { if(v == p[v]) { return v; } return p[v] = find_parent(p[v]); } void union_sets(int a,int b) { int pa = find_parent(a); int pb = find_parent(b); if(pa!=pb) { if(pb > pa)swap(pa,pb); p[pb] = pa; size [a] += size[b]; } } int main() { int n; cin >> n; make_set(n); vector<stack<int>>v(n+1,stack<int>()) set<int>se; for(int i = 1;i<=n;i++) { cin >> a[i]; se.insert(a[i]) } }

Compilation message (stderr)

Main.cpp: In function 'void union_sets(int, int)':
Main.cpp:36:6: error: 'size' was not declared in this scope; did you mean 'dysize'?
   36 |      size [a] += size[b];
      |      ^~~~
      |      dysize
Main.cpp: In function 'int main()':
Main.cpp:46:5: error: expected ',' or ';' before 'set'
   46 |     set<int>se;
      |     ^~~
Main.cpp:50:5: error: 'se' was not declared in this scope; did you mean 's'?
   50 |     se.insert(a[i])
      |     ^~
      |     s