Submission #8976

#TimeUsernameProblemLanguageResultExecution timeMemory
8976wookayinPenalty calculation (kriii2_PE)C++14
0 / 4
0 ms1672 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...