Submission #115983

# Submission time Handle Problem Language Result Execution time Memory
115983 2019-06-10T06:27:03 Z Vlatko Preokret (COCI18_preokret) C++14
50 / 50
3 ms 384 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;




int main() {
    ios::sync_with_stdio(false); cin.tie(0);

    int A, B;
    bool As[3000] = {}, Bs[3000] = {};

    cin >> A;
    for (int i = 0; i < A; ++i) {
        int s;
        cin >> s;
        As[s] = true;
    }
    cin >> B;
    for (int i = 0; i < B; ++i) {
        int s;
        cin >> s;
        Bs[s] = true;
    }

    int ans1 = 0, ans2 = 0;
    int Ascore = 0, Bscore = 0;
    bool af = false, bf = false;

    for (int s = 1; s <= 4*12*60; ++s) {
        if (As[s]) {
            ++Ascore;
            if (s <= 2*12*60) {
                ++ans1;
            }
        }
        if (Bs[s]) {
            ++Bscore;
            if (s <= 2*12*60) {
                ++ans1;
            }
        }
        if (!af && !bf) {
            if (Ascore > Bscore) {
                bf = true;
            } else {
                af = true;
            }
        }
        if (af && Ascore > Bscore) {
            ++ans2;
            af = false;
            bf = true;
        }
        if (bf && Ascore < Bscore) {
            ++ans2;
            af = true;
            bf = false;
        }
    }

    cout << ans1 << '\n' << ans2;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct