Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int n, m, k, nom;
  7.     cin >> m >> n;
  8.     if (n == m) {
  9.         cout << -1 << "\n";
  10.     }
  11.     else {
  12.         if (m > n) cout << 1 << " " << m - n << "\n";
  13.         else cout << 2 << " " << n - m << "\n";
  14.     }
  15.     fflush(stdout);
  16.     while(true) {
  17.         cin >> nom;
  18.         if (k == -1) break;
  19.         cin >> k;
  20.         if (nom == 1) cout << 2 << " " << k << "\n";
  21.         else cout << 1 << " " << k << "\n";
  22.         fflush(stdout);
  23.     }
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement