# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
146081 | youssan_william | Preokret (COCI18_preokret) | C++14 | 4 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;
typedef int ll;
int main()
{
ll a , b;
cin >> a;
ll arr[a];
ll mid=1440;
map<ll,char>mp;
vector<ll>goals;
for(int i = 0 ; i < a ;i++)
{
cin >> arr[i];
goals.push_back(arr[i]);
mp[arr[i]]='a';
}
cin >> b;
ll arr2[b];
for(int i = 0 ; i < b ;i++)
{
cin >> arr2[i];
goals.push_back(arr2[i]);
mp[arr2[i]]='b';
}
sort(goals.begin(),goals.end());
ll ans=0 , teamA=0 , teamB=0 , turnarounds=0, winA=0,winB=0 , newloser;
for(int i = 0 ; i < goals.size() ;i++)
{
if(mp[goals[i]]=='a')
teamA++;
else teamB++;
if(teamA!=teamB&&teamA!=0&&teamB!=0)
{
if(winA==0&&winB==0)
{
turnarounds++;
}
if(teamA>teamB)
{
winA=1;
if(winB==1)
{
turnarounds++;
winB=0;
}
}
else
{
winB=1;
if(winA==1)
{
turnarounds++;
winA=0;
}
}
}
if(goals[i]<=mid)
ans++;
}
ans=30897235;
cout << ans << "\n" << turnarounds ;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |