27702023-01-23 16:24:55georgeousVideójátékcpp11Wrong answer 0/100185ms13696 KiB
#include <bits/stdc++.h>
using namespace std;

int main()
{
    long long t, n, m, x;
    cin >> t >> n;
    vector<long long> me;
    vector<long long> hano;
    me.push_back(-1);
    me.push_back(-1);
    hano.push_back(-1);
    hano.push_back(-1);
    for (long long i = 0; i < n; i++)
    {
        cin >> x;
        me.push_back(x);
        cin >> x;
        me.push_back(x);
    }
    cin >> m;
    for (long long i = 0; i < m; i++)
    {
        cin >> x;
        hano.push_back(x);
        cin >> x;
        hano.push_back(x);
    }
    long long meind = 1, hanoind = 1;

    long long playtime = 0;

    while (meind <= n && hanoind <= m)
    {
        if (max(hano[2*hanoind - 1] + 1,me[2*meind]) + t + 1 >= hano[2*hanoind+1])
        {
            playtime += max(hano[2 * hanoind], me[2 * meind]) - min(hano[2 * hanoind + 1], me[2 * meind + 1]);
            if (me[2*meind + 1] < hano[2*hanoind + 1])
            {
                meind++;
            }
            else
            {
                hanoind++;
            }
        }
        else
        {
            meind++;
        }
    }

    cout << playtime << '\n';
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1684 KiB
2Wrong answer2ms1992 KiB
subtask20/10
3Accepted2ms2056 KiB
4Accepted2ms2240 KiB
5Accepted2ms2488 KiB
6Wrong answer2ms2700 KiB
7Wrong answer2ms2900 KiB
8Wrong answer2ms2928 KiB
9Accepted2ms2928 KiB
10Wrong answer2ms2932 KiB
11Wrong answer2ms3180 KiB
subtask30/20
12Wrong answer2ms3132 KiB
13Wrong answer2ms3132 KiB
14Wrong answer2ms3268 KiB
15Wrong answer2ms3388 KiB
16Wrong answer2ms3412 KiB
17Wrong answer3ms3432 KiB
18Wrong answer3ms3656 KiB
19Wrong answer4ms3908 KiB
20Wrong answer3ms3984 KiB
21Wrong answer3ms3992 KiB
22Wrong answer2ms3964 KiB
subtask40/30
23Wrong answer14ms4940 KiB
24Wrong answer48ms6732 KiB
25Wrong answer123ms12692 KiB
26Wrong answer136ms13340 KiB
27Wrong answer137ms13288 KiB
28Wrong answer54ms8236 KiB
29Wrong answer10ms4872 KiB
30Wrong answer10ms4952 KiB
31Wrong answer6ms4604 KiB
subtask50/40
32Wrong answer17ms5496 KiB
33Wrong answer59ms7224 KiB
34Wrong answer114ms10572 KiB
35Wrong answer166ms13304 KiB
36Wrong answer185ms13696 KiB
37Wrong answer182ms13696 KiB
38Wrong answer94ms9712 KiB
39Wrong answer115ms13060 KiB
40Wrong answer28ms6804 KiB
41Wrong answer43ms7176 KiB