Submission #1109271

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
11092712024-11-06 10:04:52dsyzJOI tour (JOI24_joitour)C++17
0 / 100
160 ms26556 KiB
#include <bits/stdc++.h>
#include "joitour.h"
using namespace std;
using ll = long long;
#define MAXN (200005)
ll N, Q;
ll type[MAXN];
vector<ll> v[MAXN];
ll parent[MAXN];
ll JJ[MAXN], OO[MAXN], II[MAXN];
ll jtot = 0, otot = 0, itot = 0;
ll find_set(ll x){
if(parent[x] == x) return x;
parent[x] = find_set(parent[x]);
return parent[x];
}
bool same_set(ll x,ll y){
return find_set(x) == find_set(y);
}
void merge_set(ll x,ll y){
if(same_set(x,y)) return;
ll totalJJ = JJ[find_set(x)] + JJ[find_set(y)];
ll totalOO = OO[find_set(x)] + OO[find_set(y)];
ll totalII = II[find_set(x)] + II[find_set(y)];
parent[find_set(x)] = find_set(y);
ll newroot = find_set(x);
JJ[newroot] = totalJJ;
OO[newroot] = totalOO;
II[newroot] = totalII;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...