Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Online C++ Compiler.
- Code, Compile, Run and Debug C++ program online.
- Write your code in this editor and press "Run" button to compile and execute it.
- *******************************************************************************/
- #include <iostream>
- #define MAX 1000000001
- using namespace std;
- int main()
- {
- int tab[MAX] = {};
- int n;
- std::cin >> n;
- for(int i = 0; i < n; ++i) {
- int first, second;
- std::cin >> first;
- std::cin >> second;
- tab[first]++;
- tab[second]++;
- }
- int numbers[2];
- int odd_counter = 0;
- for(int i = 0; i < MAX; ++i) {
- if(tab[i] > 0) {
- if(tab[i] % 2 == 1) {
- numbers[odd_counter] = i;
- odd_counter++;
- }
- }
- }
- if(odd_counter == 2) {
- std::cout << numbers[0] << " " << numbers[1];
- }
- else {
- std::cout << "NIE" << std::endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement