This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <functional>
#include <vector>
#include <deque>
#include <utility>
#include <bitset>
#include <limits.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef long double llf;
typedef unsigned long long llu;
int cnt[10], tm[10];
int main(int argc, char * argv[]) {
int n;
scanf("%d", &n);
int maxs = -1;
for(int i = 1; i <= n; i++) {
int t, s; scanf("%d%d", &t, &s);
maxs = max(maxs, s);
assert(s == 0 || s == 4);
if(!cnt[s]) cnt[s] = i, tm[s] = t;
}
if(maxs > 0)
printf("%d\n", tm[maxs] + (cnt[maxs] - 1) * 20);
else
puts("0");
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |