제출 #1065963

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
10659632024-08-19 13:38:15epicci23열쇠 (IOI21_keys)C++17
0 / 100
54 ms78916 KiB
#include "bits/stdc++.h"
#define all(v) v.begin() , v.end()
#define sz(a) (int)a.size()
using namespace std;
const int N = 3e5 + 5;
map<int,vector<int>> v[N];
set<int> s[N];
vector<int> cur,par(N,0),vis(N,0),mark(N,0);
vector<int> comp[N];
void merge_info(int a,int b){
a=par[a],b=par[b];
if(a==b) return;
mark[a]|=mark[b];
if(sz(s[a])<sz(s[b])) swap(s[a],s[b]);
if(sz(comp[a])<sz(comp[b])) swap(comp[a],comp[b]);
for(int x:comp[b]){
comp[a].push_back(x);
par[x]=a;
}
comp[b].clear();
for(int u:s[b]) s[a].insert(u);
s[b].clear();
int sA=0,sB=0;
for(auto x:v[a]) sA+=sz(x.second);
for(auto x:v[b]) sB+=sz(x.second);
if(sA<sB) swap(v[a],v[b]);
for(auto x:v[b]) for(int u:x.second) v[a][x.first].push_back(u);
v[b].clear();
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...