Advertisement
jeff69

Untitled

Dec 30th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4. const int MX=2e5+3;
  5. int n;//k,t=0;
  6. int lat=0,longt=0;
  7. int main()
  8. {
  9. cin>>n;
  10. for(int i=0;i<n;i++)
  11. {
  12. int a;
  13. string b;
  14. cin>>a>>b;
  15. if(longt==0)
  16. {
  17. if(b!="South")
  18. {
  19. cout<<"NO";
  20. return 0;
  21. }
  22. }if(longt==20000)
  23. {
  24. if(b!="North")
  25. {
  26. cout<<"NO";
  27. return 0;
  28. }
  29. }
  30. if(b=="South")longt+=a;
  31. if(b=="North")longt-=a;
  32.  
  33. if(longt<0||longt>20000)
  34. {
  35. cout<<"NO";
  36. return 0;
  37. }
  38. }
  39. //cout<<lat<<' '<<longt<<'$';
  40. if(longt==0)
  41. {
  42. cout<<"YES";
  43. }
  44. else cout<<"NO";
  45. return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement