$O(nl)$
#include<iostream> #include<string> using namespace std; int n, x, y, z, f, a, b = 1e9; string s, as, bs; int main() { for (cin >> n; n--;) { cin >> s >> x >> y >> z; f = x + y * 31 + z * 366; if (f > a) a = f, as = s; if (f < b) b = f, bs = s; } cout << as + '\n' + bs; return 0; }
댓글 없음 :
댓글 쓰기