Submission #9005

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