Advertisement
toffanetto_

B

Nov 14th, 2020
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. /* goldStack
  2. * Emanuel Alves da Silva E Souza
  3. * Gabriel Toffanetto França da Rocha
  4. * Willian Ferraz Gobira
  5. * Universidade Federal de Itajubá - Campus Itabira
  6. * Maratona de Programação -- 2020 -- 1a fase
  7. *
  8. */
  9.  
  10. #include <iostream>
  11. #include <set>
  12.  
  13. using namespace std;
  14.  
  15. int main(){
  16. ios_base::sync_with_stdio(false);
  17. cin.tie(NULL);
  18.  
  19. int n;
  20. cin >> n;
  21. bool flag=true;
  22. int c,d,l,r;
  23. set<pair<int,int>> navios;
  24.  
  25. for(int i=0;i<n;i++){
  26. cin >> d >> l >> r >>c;
  27. pair<int,int> pos;
  28. for(int j=1;j<=l;j++){
  29. if(d==1){
  30. if(r+l>10)
  31. flag = false;
  32. pos = make_pair(r+j,c);
  33. }
  34. else{
  35. if(c+l>10)
  36. flag = false;
  37. pos = make_pair(r,c+j);
  38. }
  39.  
  40. if(navios.find(pos)==navios.end())
  41. navios.insert(pos);
  42. else
  43. flag=false;
  44. }
  45. }
  46.  
  47. if(flag)
  48. cout << "Y" << endl;
  49. else
  50. cout << "N" << endl;
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement