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 <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iostream>
#include <sstream>
using namespace std;
int main() {
int n;
while(cin >> n) {
vector<int> t(n), s(n);
int score = 0;
for(int i=0; i<n; ++i) {
cin >> t[i] >> s[i];
score = max(score, s[i]);
}
int end = -1;
int penalty = 0;
for(int i=n-1; i>=0; --i) {
if(score == s[i]) {
end = i;
penalty += t[i];
break;
}
}
for(int i = 0; i < end; ++ i) {
penalty += 20;
}
if(score == 0) penalty = 0;
cout << penalty << endl;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |