/***
Md. Namzul Hasan
Shahjalal University of Science & technology,sylhet.
hasan08sust@gmail.com
***/
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
typedef int in ;
typedef unsigned long long ull ;
const double pi = 2*acos(0) ;
#define maxi 40000
#define pf printf
#define sc scanf
#define pb push_back
#define MEM(x,y) (memset((x),(y),sizeof(x)))
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define MAX(x,y) ((x) > (y) ? (x) : (y))
int d ,m,y ;
struct ans
{
string name ;
int yy ,mm , dd ;
} socity[10001];
bool comp(ans a , ans b)
{
if(a.yy == b.yy)
{
if(a.mm == b.mm)
{
return (a.dd>b.dd) ;
}
return a.mm>b.mm ;
}
return a.yy > b.yy ;
}
int main()
{
int person ;
string str ;
cin>>person ;
for(int i=0 ; i<person ; i++)
{
cin>>str>>d>>m>>y ;
socity[i].name = str ;
socity[i].dd = d ;
socity[i].mm = m ;
socity[i].yy = y ;
}
sort(socity , socity+person , comp) ;
cout<<socity[0].name<<endl ;
cout<<socity[person-1].name<<endl ;
return 0;
}
Md. Namzul Hasan
Shahjalal University of Science & technology,sylhet.
hasan08sust@gmail.com
***/
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
typedef int in ;
typedef unsigned long long ull ;
const double pi = 2*acos(0) ;
#define maxi 40000
#define pf printf
#define sc scanf
#define pb push_back
#define MEM(x,y) (memset((x),(y),sizeof(x)))
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define MAX(x,y) ((x) > (y) ? (x) : (y))
int d ,m,y ;
struct ans
{
string name ;
int yy ,mm , dd ;
} socity[10001];
bool comp(ans a , ans b)
{
if(a.yy == b.yy)
{
if(a.mm == b.mm)
{
return (a.dd>b.dd) ;
}
return a.mm>b.mm ;
}
return a.yy > b.yy ;
}
int main()
{
int person ;
string str ;
cin>>person ;
for(int i=0 ; i<person ; i++)
{
cin>>str>>d>>m>>y ;
socity[i].name = str ;
socity[i].dd = d ;
socity[i].mm = m ;
socity[i].yy = y ;
}
sort(socity , socity+person , comp) ;
cout<<socity[0].name<<endl ;
cout<<socity[person-1].name<<endl ;
return 0;
}
No comments:
Post a Comment