forked from imdhanish/HackerEarth
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDedication_Level.cpp
More file actions
34 lines (33 loc) · 764 Bytes
/
Dedication_Level.cpp
File metadata and controls
34 lines (33 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, hours, f = 0, s = 0, t = 0;
string name, first = "Ram", second = "Shyam", third = "Ghanshyam";
cin >>n;
for(int i=0; i<n; i++){
cin >>name >>hours;
if(hours > f){
t = s;
s = f;
f = hours;
third = second;
second = first;
first = name;
}
else if(hours > s){
t = s;
s = hours;
third = second;
second = name;
}
else if(hours > t){
t = hours;
third = name;
}
}
cout <<first <<endl <<second <<endl <<third;
return 0;
}