# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
199736 | SamAnd | ACM (COCI19_acm) | C++17 | 16 ms | 1144 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 <bits/stdc++.h>
using namespace std;
const int N = 1003, M = 20;
struct ban
{
string name;
int q, p;
ban()
{
q = p = 0;
}
};
bool operator<(const ban& a, const ban& b)
{
if (a.q > b.q)
return true;
if (a.q < b.q)
return false;
if (a.p < b.p)
return true;
if (a.p > b.p)
return false;
return a.name < b.name;
}
int n, m;
ban a[N];
string s[N][M];
int main()
{
cin >> n >> m;
for (int i = 1; i <= n + 1; ++i)
{
cin >> a[i].name;
for (int j = 1; j <= m; ++j)
cin >> s[i][j];
}
for (int i = 1; i <= n; ++i)
{
if (a[i].name == a[n + 1].name)
{
for (int j = 1; j <= m; ++j)
{
if (s[n + 1][j][0] != '-')
{
++a[i].q;
a[i].p += (s[n + 1][j][1] - '0') * 20 * 60;
a[i].p += ((s[n + 1][j][3] - '0') * 10 + (s[n + 1][j][4] - '0')) * 60 * 60;
a[i].p += ((s[n + 1][j][6] - '0') * 10 + (s[n + 1][j][7] - '0')) * 60;
a[i].p += ((s[n + 1][j][9] - '0') * 10 + (s[n + 1][j][10] - '0'));
}
}
}
else
{
for (int j = 1; j <= m; ++j)
{
if (s[i][j][0] != '-')
{
++a[i].q;
a[i].p += (s[i][j][1] - '0') * 20 * 60;
a[i].p += ((s[i][j][3] - '0') * 10 + (s[i][j][4] - '0')) * 60 * 60;
a[i].p += ((s[i][j][6] - '0') * 10 + (s[i][j][7] - '0')) * 60;
a[i].p += ((s[i][j][9] - '0') * 10 + (s[i][j][10] - '0'));
}
}
}
}
sort(a + 1, a + n + 1);
for (int i = 1; i <= n; ++i)
{
if (a[i].name == a[n + 1].name)
{
cout << i << endl;
return 0;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |