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 <algorithm>
#include <cstdio>
struct ProblemInfo {
int t;
int s;
int p_number;
};
bool cmp(const ProblemInfo& a, const ProblemInfo& b) {
return a.s > b.s;
}
int main() {
ProblemInfo p[100];
int num_of_solutions = 0;
scanf(" %d", &num_of_solutions);
for (int i = 0; i < num_of_solutions; ++i) {
scanf(" %d %d", &p[i].t, &p[i].s);
p[i].p_number = i + 1;
}
std::sort(p, p + num_of_solutions, cmp);
int max_num = p[0].s;
int fuck = 0;
int f = p[0].p_number;
for (int i = 0; i < num_of_solutions; ++i) {
if (p[i].s == max_num) {
if (p[i].p_number < f) {
f = p[i].p_number;
fuck = i;
}
}
else {
break;
}
}
if (p[fuck].s == 0) {
printf("0\n");
}
else if (p[fuck].s == 1 || p[fuck].s == 4) {
printf("%d", p[fuck].t + (f - 1) * 20);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |