Created
January 31, 2016 10:35
-
-
Save I-See-You/e8066e0b3a2ffbf5430e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
struct data | |
{ | |
string s; | |
int day,month,year; | |
}input[101]; | |
bool comp(data x,data y) | |
{ | |
if(x.year != y.year) return x.year < y.year; | |
if(x.month != y.month) return x.month < y.month; | |
return x.day < y.day; | |
} | |
int main() | |
{ | |
int n; | |
while(cin >> n) | |
{ | |
for(int i=0;i<n;i++){ | |
string ss; | |
int x,y,z; | |
cin >> ss >> x >> y >> z; | |
input[i].s = ss; | |
input[i].day = x; | |
input[i].month = y; | |
input[i].year = z; | |
} | |
sort(input,input+n,comp); | |
// for(int i=0;i<n;i++) cout << input[i].s << endl; | |
cout << input[n-1].s << endl << input[0].s << endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment