Advertisement
rjlth

Untitled

Dec 3rd, 2014
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. vector<int> a, b;
  2. int n, x, l, bo;
  3. string s, t;
  4. ll s1, s2;
  5.  
  6. int main()
  7. {
  8. #ifndef ONLINE_JUDGE
  9. freopen("input.txt","rt",stdin);
  10. freopen("output.txt","wt",stdout);
  11. #endif
  12. cin>>n;
  13. s1=s2=0;
  14. for (int i=0; i<n; i++) {
  15. scanf("%d", &x);
  16. if (x>0) a.pb(x), s1+=x, l=1; else
  17. b.pb(-x), s2+=-x, l=2;
  18. }
  19. bo=0;
  20. for (int i=0; i<min(a.sz, b.sz); i++) {
  21. if (a[i]>b[i]) bo=1; else
  22. if (a[i]<b[i]) bo=2;
  23. if (bo) break;
  24. }
  25. if (!bo) {
  26. if (a.sz>b.sz) bo=1; else
  27. if (a.sz<b.sz) bo=2;
  28. }
  29. s="first"; t="second";
  30. if (s1>s2) cout<<s; else
  31. if (s1<s2) cout<<t; else
  32. if (bo==1) cout<<s; else
  33. if (bo==2) cout<<t; else
  34. if (l==1) cout<<s; else
  35. cout<<t;
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement