Submission #145926

#TimeUsernameProblemLanguageResultExecution timeMemory
145926youssan_williamPreokret (COCI18_preokret)C++14
16.40 / 50
4 ms504 KiB
#include <bits/stdc++.h>

using namespace std;
typedef long long 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());
    int ans=0 , teamA=0 , teamB=0 , turnarounds=0,loser=-1, 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(teamA>teamB) newloser=1;
            else newloser=0;
            if(newloser!=loser)
            {
                loser=newloser;
                turnarounds++;
            }
        }
        if(goals[i]<=mid)
            ans++;

    }
    cout << ans << "\n" << turnarounds ;
    return 0;
}

Compilation message (stderr)

preokret.cpp: In function 'int main()':
preokret.cpp:29:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0 ; i < goals.size() ;i++)
                     ~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...