#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 |
1 |
Correct |
0 ms |
1672 KB |
Output is correct |
2 |
Correct |
0 ms |
1672 KB |
Output is correct |
3 |
Incorrect |
0 ms |
1672 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |