Submission #1068234

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10682342024-08-21 08:46:49epicci23Dango Maker (JOI18_dango_maker)C++17
13 / 100
0 ms596 KiB
#include "bits/stdc++.h"
//#define int long long
#define all(v) v.begin() , v.end()
//#define sz(a) (int)a.size()
using namespace std;
const int N = 205;
pair<int,int> par[N][N];
array<int,3> sz[N][N];
pair<int,int> find(int a,int b){
if(par[a][b]==make_pair(a,b)) return make_pair(a,b);
return par[a][b]=find(par[a][b].first,par[a][b].second);
}
void merge(int a,int b,int c,int d){
auto x=find(a,b);
auto y=find(c,d);
a=x.first,b=x.second,c=y.first,d=y.second;
if(make_pair(a,b)==make_pair(c,d)) return;
if(sz[a][b][0]+sz[a][b][1]+sz[a][b][2]<sz[c][d][0]+sz[c][d][1]+sz[c][d][2]){
swap(a,c);
swap(b,d);
}
par[c][d]=par[a][b];
for(int j=0;j<3;j++) sz[a][b][j]+=sz[c][d][j];
}
void _(){
int n,m;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...