Submission #377352

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3773522021-03-14 04:25:48ThistleConnecting Supertrees (IOI20_supertrees)C++14
56 / 100
281 ms22252 KiB
#include "supertrees.h"
#include <vector>
#include<algorithm>
#include<set>
#include<iostream>
using namespace std;
using ll=long long;
using H=pair<ll, ll>;
#define vec vector
#define vi vec<ll>
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define rep(i,n) rng((i),0,(n))
#define siz(a) int((a).size())
class unionfind{
int n;
vi pa,sz;
public:
unionfind(int n):n(n){
pa.resize(n);
sz.assign(n,1);
rep(i,n) pa[i]=i;
}
int root(int x){
if(pa[x]==x) return x;
return pa[x]=root(pa[x]);
}
void unite(int x,int y){
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

supertrees.cpp: In constructor 'unionfind::unionfind(int)':
supertrees.cpp:13:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   13 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
supertrees.cpp:14:18: note: in expansion of macro 'rng'
   14 | #define rep(i,n) rng((i),0,(n))
      |                  ^~~
supertrees.cpp:24:3: note: in expansion of macro 'rep'
   24 |   rep(i,n) pa[i]=i;
      |   ^~~
supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:13:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   13 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
supertrees.cpp:14:18: note: in expansion of macro 'rng'
   14 | #define rep(i,n) rng((i),0,(n))
      |                  ^~~
supertrees.cpp:45:2: note: in expansion of macro 'rep'
   45 |  rep(i,n)rep(j,n){
      |  ^~~
supertrees.cpp:13:28: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
   13 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
supertrees.cpp:14:18: note: in expansion of macro 'rng'
   14 | #define rep(i,n) rng((i),0,(n))
      |                  ^~~
supertrees.cpp:45:10: note: in expansion of macro 'rep'
   45 |  rep(i,n)rep(j,n){
      |          ^~~
supertrees.cpp:13:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   13 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
supertrees.cpp:14:18: note: in expansion of macro 'rng'
   14 | #define rep(i,n) rng((i),0,(n))
      |                  ^~~
supertrees.cpp:49:2: note: in expansion of macro 'rep'
   49 |  rep(i,n)rep(j,n){
      |  ^~~
supertrees.cpp:13:28: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
   13 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
supertrees.cpp:14:18: note: in expansion of macro 'rng'
   14 | #define rep(i,n) rng((i),0,(n))
      |                  ^~~
supertrees.cpp:49:10: note: in expansion of macro 'rep'
   49 |  rep(i,n)rep(j,n){
      |          ^~~
supertrees.cpp:13:28: warning: unnecessary parentheses in declaration of 'x' [-Wparentheses]
   13 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
supertrees.cpp:14:18: note: in expansion of macro 'rng'
   14 | #define rep(i,n) rng((i),0,(n))
      |                  ^~~
supertrees.cpp:59:2: note: in expansion of macro 'rep'
   59 |  rep(x,n){
      |  ^~~
supertrees.cpp:13:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   13 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
supertrees.cpp:14:18: note: in expansion of macro 'rng'
   14 | #define rep(i,n) rng((i),0,(n))
      |                  ^~~
supertrees.cpp:62:3: note: in expansion of macro 'rep'
   62 |   rep(i,n){
      |   ^~~
supertrees.cpp:13:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   13 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
supertrees.cpp:14:18: note: in expansion of macro 'rng'
   14 | #define rep(i,n) rng((i),0,(n))
      |                  ^~~
supertrees.cpp:71:16: note: in expansion of macro 'rep'
   71 |   for(auto g:v)rep(i,n){
      |                ^~~
supertrees.cpp:13:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   13 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
supertrees.cpp:14:18: note: in expansion of macro 'rng'
   14 | #define rep(i,n) rng((i),0,(n))
      |                  ^~~
supertrees.cpp:90:5: note: in expansion of macro 'rep'
   90 |     rep(i,n){
      |     ^~~
supertrees.cpp:13:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   13 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
supertrees.cpp:14:18: note: in expansion of macro 'rng'
   14 | #define rep(i,n) rng((i),0,(n))
      |                  ^~~
supertrees.cpp:99:4: note: in expansion of macro 'rep'
   99 |    rep(i,siz(u)-1){
      |    ^~~
supertrees.cpp:13:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   13 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
supertrees.cpp:14:18: note: in expansion of macro 'rng'
   14 | #define rep(i,n) rng((i),0,(n))
      |                  ^~~
supertrees.cpp:106:3: note: in expansion of macro 'rep'
  106 |   rep(i,siz(cic)-1){
      |   ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...