# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
374049 | duchung | 조이터에서 친구를 만드는건 재밌어 (JOI20_joitter2) | C++17 | 717 ms | 41184 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#define ii pair<int , int>
#define ll long long
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n , m;
ll ans = 0;
int parent[N];
ll sz[N];
set<ii> edge[N];
set<int> group[N];
int find_set(int u)
{
return parent[u] == u ? u : find_set(parent[u]);
}
void join(int U , int V)
{
int u = find_set(U) , v = find_set(V);
if (u == v) return;
auto it = edge[v].lower_bound(make_pair(u , 0));
if (it != edge[v].end() && it->first == u)
{
ans += sz[u] * sz[v] * 2;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |