Submission #92148

# Submission time Handle Problem Language Result Execution time Memory
92148 2019-01-01T17:18:45 Z Kastanda Preokret (COCI18_preokret) C++11
35.9 / 50
2 ms 376 KB
#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

preokret.cpp: In function 'int main()':
preokret.cpp:16:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < A.size(); i++)
                     ~~^~~~~~~~~~
preokret.cpp:21:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < A.size(); i++)
                     ~~^~~~~~~~~~
preokret.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &n);
         ~~~~~^~~~~~~~~~
preokret.cpp:13:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", &a), A.push_back({a, w});
             ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Partially correct 2 ms 376 KB Output is partially correct
8 Partially correct 2 ms 376 KB Output is partially correct
9 Partially correct 2 ms 376 KB Output is partially correct
10 Correct 2 ms 376 KB Output is correct