답안 #146082

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
146082 2019-08-22T01:44:15 Z youssan_william Preokret (COCI18_preokret) C++14
2 / 50
4 ms 504 KB
#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++;

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

Compilation message

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++)
                     ~~^~~~~~~~~~~~~~
preokret.cpp:28:67: warning: unused variable 'newloser' [-Wunused-variable]
     ll ans=0 , teamA=0 , teamB=0 , turnarounds=0, winA=0,winB=0 , newloser;
                                                                   ^~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 2 ms 376 KB Output is partially correct
2 Partially correct 2 ms 376 KB Output is partially correct
3 Partially correct 2 ms 376 KB Output is partially correct
4 Partially correct 2 ms 376 KB Output is partially correct
5 Partially correct 2 ms 376 KB Output is partially correct
6 Partially correct 3 ms 376 KB Output is partially correct
7 Partially correct 3 ms 504 KB Output is partially correct
8 Partially correct 3 ms 376 KB Output is partially correct
9 Partially correct 4 ms 504 KB Output is partially correct
10 Partially correct 2 ms 376 KB Output is partially correct