Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <algorithm>
  5.  
  6. using namespace std;
  7.  
  8. /**
  9. * Auto-generated code below aims at helping you parse
  10. * the standard input according to the problem statement.
  11. **/
  12. /**
  13. * Auto-generated code below aims at helping you parse
  14. * the standard input according to the problem statement.
  15. **/
  16. int main()
  17. {
  18. int N, cnt;
  19. cin >> N;
  20. cin.ignore();
  21. string min;
  22. string t;
  23. cin >> t;
  24. cin.ignore();
  25. min = t;
  26. for (int i = 1; i < N; i++) {
  27. cerr << min << endl;
  28. cin >> t;
  29. cin.ignore();
  30. cerr << t << "<" << min << endl;
  31. if (t[0] < min[0]) {
  32. min = t;
  33. }
  34. else if (t[0] == min[0]) {
  35. if (t[1] < min[1]) {
  36. cerr << "~" << t[1] << "<" << min[1]<< endl;
  37. min = t;
  38. }
  39.  
  40. else if (t[1] == min[1] && t[3] < min[3]) {
  41. cerr << "#" << t[3] << "<" << min[3]<< endl;
  42. min = t;
  43. cnt = 1;
  44. }
  45. if (cnt != 1)
  46. if (t[3] == min[3]) {
  47. if (t[4] < min[4]) {
  48. min = t;
  49. }
  50.  
  51. else if (t[6] < min[6]) {
  52. min = t;
  53. }
  54. else if (t[6] == min[6]) {
  55. if (t[7] < min[7])
  56. min = t;
  57. }
  58. }
  59. }
  60. }
  61.  
  62. // Write an action using cout. DON'T FORGET THE "<< endl"
  63. // cerr << "Debug messages..." << endl;
  64.  
  65. cout << min << endl;
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement