Submission #1125246

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
11252462024-12-08 19:36:50PekibanWerewolf (IOI18_werewolf)C++20
49 / 100
4097 ms136380 KiB
#include "werewolf.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
const int N = 4e5 + 5, LOG = 19, SQ = 500;
struct krt {
vector<int> g[N];
int a[N], p[N], W[N], tin[N], tout[N], up[LOG][N], C, tm;
bool fl = 0; // fl = 1 za MX, 0 za MN
void init(int n) {
C = n-1;
iota(p, p+N, 0);
iota(W, W+N, 0);
}
int get(int x) {
if (x == p[x]) return x;
return p[x] = get(p[x]);
}
bool unite(int u, int v) {
u = get(u), v = get(v);
if (u == v) return 0;
p[u] = p[v] = ++C;
W[C] = (fl ? min(W[u], W[v]) : max(W[u], W[v]));
g[C].pb(u); g[C].pb(v); g[u].pb(C); g[v].pb(C);
return 1;
}
void dfs(int s, int e = -1) {
tin[s] = ++tm;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
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...