This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("Ofast" , "unroll-loops")
#include<bits/stdc++.h>
#define bit(i , j) ((j >> i) & 1)
#define fi first
#define se second
#define all(x) (x).begin() , (x).end()
using namespace std;
const int MAXN = 2e5+100;
const long long inf = 1e9 + 7;
#define int long long
#define pll pair<int , int>
#define MP make_pair
unordered_map<int , int> par , sz;
map<int , vector<int>> Ox;
int find(int x){
	return (par[x] == x ? x : par[x] = find(par[x]));
}
int joint(int u , int v){
	u = find(u) , v = find(v);
	if(u == v) return 0;
	if(sz[u] < sz[v]) swap(u , v);
	sz[u] += sz[v];
	par[v] = u;
	return 1;
}
int bpow(int a , int b){
	if(b == -1) return bpow(a , inf-2);
	if(b == 0) return 1;
	int res = bpow(a , b/2);
	if(b & 1) return a * res % inf * res % inf;
	else return res * res % inf;
}
int32_t main(){
	//freopen("seq.inp", "r", stdin);
   //freopen("seq.out", "w", stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int n , m , k; cin >> n >> m >> k;
	while(k--){
		char c; cin >> c;
		int x , y; cin >> x >> y;
		par[x] = x; sz[x] = 1; 
		Ox[y].push_back(x);
	}
	int cnt = n;
	for(auto t : Ox){
		int lst = -1;
		for(auto x : t.se){
			if(lst != -1) if(joint(x , lst)) cnt--;
			lst = x;
		}
	}
	cout << 0 << "\n";
	return 0;
	int x = Ox.size();
	cout << bpow(2 , cnt) * bpow(2 , m - 1 - x) % inf << "\n";
	
	return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |