Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. usingnamespace std;
  4.  
  5. int main ()
  6. {
  7. int n,x,y, s=0;
  8. cin >> n;
  9. int a[n+1][2] = 0;
  10. for (int i=0; i<2n-s; i+=2)
  11. {
  12. cout <<i<<" "<<i+1;
  13. cin >> x >> y;
  14. if (uslov za sucses kod cin)
  15. {
  16. if (a[x][0] == 0) a[x][0] = i;
  17. else a[x][1] = i;
  18. if (a[y][0] == 0) a[y][0] = i+1;
  19. else a[y][1] = i+1;
  20. }
  21. else s+=2;
  22. }
  23. for (int i=1; i<n-s; i++)
  24. {
  25. if (a[i][0] != 0)
  26. {cout << a[i][0] << a[i][1];}
  27. }
  28. cout << -1;
  29. return 0;
  30. }
  31.  
  32. // ima neka fula u syntaci nadji je
  33. // to je to odprilike ja ga uradio na mobu
  34. // ubaci gore uslov
  35. // ubaci flush gdje treba
  36. // i skontaj sta radi
  37. //ako bude trebalo debugg
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement