OverClocking!
This commit is contained in:
		
							
								
								
									
										50
									
								
								Luogu/CodeOverclock/P1551 亲戚.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								Luogu/CodeOverclock/P1551 亲戚.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,50 @@
 | 
			
		||||
#include <iostream>
 | 
			
		||||
#include <vector>
 | 
			
		||||
#include <utility>
 | 
			
		||||
using namespace std;
 | 
			
		||||
 | 
			
		||||
int main(){
 | 
			
		||||
	int n, m, p;
 | 
			
		||||
	cin >> n >> m >> p;
 | 
			
		||||
	vector<vector<pair<int, int>>> table;
 | 
			
		||||
	table.resize(n + 1);
 | 
			
		||||
	int a, b;
 | 
			
		||||
	for(int i = 0; i < m; i++){
 | 
			
		||||
		cin >> a >> b;
 | 
			
		||||
		
 | 
			
		||||
	} 
 | 
			
		||||
	//unordered_map<int, int> s, rs;
 | 
			
		||||
	//rs : Value -> Key
 | 
			
		||||
	
 | 
			
		||||
	/*
 | 
			
		||||
	int a, b;
 | 
			
		||||
	for(int i = 0; i < m; i++){
 | 
			
		||||
		cin >> a >> b;
 | 
			
		||||
		if(rs.count(a) == 0 && rs.count(b) == 0){
 | 
			
		||||
			rs.emplace(make_pair(a, i));
 | 
			
		||||
			rs.emplace(make_pair(b, i));
 | 
			
		||||
			s.emplace(make_pair(i, a));
 | 
			
		||||
			s.emplace(make_pair(i, b))
 | 
			
		||||
		}
 | 
			
		||||
		else if(rs.count(a) == 0 && rs.count(b) !=0){
 | 
			
		||||
			int key = rs.find(b)->second;
 | 
			
		||||
			rs.emplace(make_pair(a, key));
 | 
			
		||||
			s.emplace(make_pair(key, a));
 | 
			
		||||
		}
 | 
			
		||||
		else if(rs.count(b) == 0 && rs.count(a) !=0){
 | 
			
		||||
			int key = rs.find(a)->second;
 | 
			
		||||
			rs.emplace(make_pair(b, key));
 | 
			
		||||
			s.emplace(make_pair(key, b));
 | 
			
		||||
		}
 | 
			
		||||
		else{
 | 
			
		||||
			int keya = rs.find(a)->second;
 | 
			
		||||
			int keyb = rs.find(b)->second;
 | 
			
		||||
			if(s.count(keya) < s.count(keyb)){
 | 
			
		||||
				//move bucket keya to keyb
 | 
			
		||||
				//noooooooooo, can't change key
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
	}*/
 | 
			
		||||
	return 0;
 | 
			
		||||
} 
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							
		Reference in New Issue
	
	Block a user