This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef pair<int, int> PAIR;
bool cmp(PAIR a, PAIR b) {
return a.second > b.second;
}
int stamp[301];
int main(void) {
int T;
vector<PAIR> set;
cin >> T;
for (int i = 0; i < T; i++) {
int t, s;
cin >> t >> s;
stamp[t] = i + 1;
set.push_back(PAIR(t, s));
}
sort(set.begin(), set.end(), cmp);
int tf = set[0].first;
int sf = set[0].second;
int p ;
if (sf == 0) {
p = 0;
}
else if (sf == 1 || sf == 4) {
p = tf + (stamp[tf] - 1) * 20;
}
cout << p << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |