# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
223371 | maomao90 | ACM (COCI19_acm) | C++14 | 10 ms | 512 KiB |
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 <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>
using namespace std;
typedef tuple <int, int, string> iis;
int N, M;
vector <iis> standings;
bool comp(iis right, iis left)
{
int rSolve, rTime, lSolve, lTime; string rName, lName;
tie(rSolve, rTime, rName) = right; tie(lSolve, lTime, lName) = left;
if (rSolve > lSolve) return true;
else if (rSolve == lSolve)
{
if (rTime < lTime) return true;
else if (rTime == lTime)
{
if (rName.compare(lName) < 0) return true;
}
}
return false;
}
int main()
{
scanf("%d%d", &N, &M);
for (int i = 0; i <= N; i++)
{
char temp[25]; scanf(" %s", temp);
string name = temp;
int penaltyTime = 0, solved = 0;
for (int i = 0; i < M; i++)
{
char sxv[20]; scanf(" %s", sxv);
char s = sxv[0];
if (s == '-')
{
continue;
}
else
{
solved++;
int attempts = sxv[1] - '0';
penaltyTime += (attempts - 1) * (20 * 60);
int hours = (sxv[3] - '0') * 10 + (sxv[4] - '0'),
minutes = (sxv[6] - '0') * 10 + (sxv[7] - '0'),
seconds = (sxv[9] - '0') * 10 + (sxv[10] - '0');
penaltyTime += seconds + minutes * 60 + hours * 60 * 60;
}
}
if (name == "NijeZivotJedanACM" && i != N) continue;
else
{
standings.emplace_back(solved, penaltyTime, name);
}
}
sort(standings.begin(), standings.end(), comp);
for (int i = 0; i < N; i++)
{
if (get<2>(standings[i]) == "NijeZivotJedanACM")
{
printf("%d\n", i + 1);
return 0;
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |