Nathan Coulas

CCC '14 S2 - Assigning Partners

ccc14s2 CPP17 06 May, 2020 0.131s 5 points

Source Code

#include <bits/stdc++.h>
using namespace std;

int main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	int n;
	cin >> n;
	if(n % 2 != 0){
		cout << "bad\n";
		return 0;
	}
	
	string arr1[n];
	string arr2[n];
	
	for(int i = 0; i < n; i++){
		cin >> arr1[i];
	}
	
	for(int i = 0; i < n; i++){
		cin >> arr2[i];
	}
	
	for(int i = 0; i < n; i++){
		
		for(int j = 0; j < n; j++){
			
			if(arr1[i] == arr2[j]){
				if(arr2[i] != arr1[j] || j == i){
					cout << "bad";
					return 0;
				}
			}
			
		}
		
	}
	
	cout << "good\n";
	
	return 0;
}