# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
92148 | Kastanda | Preokret (COCI18_preokret) | C++11 | 2 ms | 376 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 TM = 4 * 12 * 60;
int main()
{
int C[2] = {0, 0};
vector < pair < int , int > > A;
for (int w = 0; w <= 1; w ++)
{
int n;
scanf("%d", &n);
for (int i = 1, a; i <= n; i++)
scanf("%d", &a), A.push_back({a, w});
}
int cnt1 = 0, cnt2 = 0;
for (int i = 0; i < A.size(); i++)
if (A[i].first < TM / 2)
cnt1 ++;
sort(A.begin(), A.end());
int loser = -1;
for (int i = 0; i < A.size(); i++)
{
C[A[i].second] ++;
if (loser == A[i].second && C[A[i].second] > C[!A[i].second])
cnt2 ++;
if (C[A[i].second] > C[!A[i].second])
loser = !A[i].second;
}
return !printf("%d\n%d\n", cnt1, cnt2);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |