Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- #include <algorithm>
- using namespace std;
- /**
- * Auto-generated code below aims at helping you parse
- * the standard input according to the problem statement.
- **/
- /**
- * Auto-generated code below aims at helping you parse
- * the standard input according to the problem statement.
- **/
- int main()
- {
- int N, cnt;
- cin >> N;
- cin.ignore();
- string min;
- string t;
- cin >> t;
- cin.ignore();
- min = t;
- for (int i = 1; i < N; i++) {
- cerr << min << endl;
- cin >> t;
- cin.ignore();
- cerr << t << "<" << min << endl;
- if (t[0] < min[0]) {
- min = t;
- }
- else if (t[0] == min[0]) {
- if (t[1] < min[1]) {
- cerr << "~" << t[1] << "<" << min[1]<< endl;
- min = t;
- }
- else if (t[1] == min[1] && t[3] < min[3]) {
- cerr << "#" << t[3] << "<" << min[3]<< endl;
- min = t;
- cnt = 1;
- }
- if (cnt != 1)
- if (t[3] == min[3]) {
- if (t[4] < min[4]) {
- min = t;
- }
- else if (t[6] < min[6]) {
- min = t;
- }
- else if (t[6] == min[6]) {
- if (t[7] < min[7])
- min = t;
- }
- }
- }
- }
- // Write an action using cout. DON'T FORGET THE "<< endl"
- // cerr << "Debug messages..." << endl;
- cout << min << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement