alphacademy-cpp/hf/hf5/1.cpp

68 lines
1.4 KiB
C++
Raw Normal View History

2022-11-24 19:44:22 +00:00
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
struct tanulok {
int ev;
int ho;
int nap;
int kezdes;
int vegzes;
};
int main() {
int n;
cin >> n;
vector<tanulok> tan(n);
for (int i = 0; i < n; i++) {
cin >> tan[i].ev >> tan[i].ho >> tan[i].nap >> tan[i].kezdes >> tan[i].vegzes;
}
int max = 0;
int maxI;
bool tovabb = false;
vector<int> a;
for (int i = 0; i < n; i++) {
if (max < tan[i].ev) {
max = tan[i].ev;
maxI = i;
}
}
for (int i = 0; i < n; i++) {
if (max == tan[i].ev) {
a.push_back(i);
}
}
max = 0;
// for (int i = 0; i < a.size(); i++) {
// cout<<a[i]<<' ';
// }
//cout<<endl;
vector<int> b;
for (int i = 0; i < a.size(); i++) {
if (max < tan[a[i]].ho) {
max = tan[a[i]].ho;
maxI = a[i];
//cout<<"if fired "<< i<<' '<< a[i] <<' '<<tan[a[i]].ho<<endl;
}
}
for (int i = 0; i < n; i++) {
if (max == tan[i].ho) {
b.push_back(i);
}
}
max =0;
for (int i = 0; i < b.size(); i++) {
if (max < tan[b[i]].nap) {
max = tan[b[i]].nap;
maxI = b[i];
//cout<<"if fired "<< i<<' '<< a[i] <<' '<<tan[a[i]].ho<<endl;
}
}
cout << tan[maxI].ev << ' '<<tan[maxI].ho<<' '<<tan[maxI].nap;
}