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;
struct event{
long long t, a, b;
};
bool cmp(event truoc, event sau)
{
return truoc.t < sau.t;
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long n;
cin >> n;
event arr[n + 1];
for (int i = 1; i <= n; i++) cin >> arr[i].t >> arr[i].a >> arr[i].b;
sort (arr + 1, arr + 1 + n, cmp);
long long teama = 0, teamb = 0, pre = 0, awin = 0, bwin = 0, num = 0;
for (int i = 1; i <= n; i++)
{
if (arr[i].a <= 4 && arr[i].b >= 5)
{
if (i > 1 && arr[i].t - pre <= 10 && awin && arr[i].a == num) teama += 50;
teama += 100;
awin = 1;
bwin = 0;
}
if (arr[i].a >= 5 && arr[i].b <= 4)
{
if (i > 1 && arr[i].t - pre <= 10 && bwin && arr[i].b == num) teamb += 50;
teamb += 100;
bwin = 1;
awin = 0;
}
pre = arr[i].t;
num = arr[i].a;
}
cout << teama << " " << teamb;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |