2770 | 2023-01-23 16:24:55 | georgeous | Videójáték | cpp11 | Wrong answer 0/100 | 185ms | 13696 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';
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1684 KiB | ||||
2 | Wrong answer | 2ms | 1992 KiB | ||||
subtask2 | 0/10 | ||||||
3 | Accepted | 2ms | 2056 KiB | ||||
4 | Accepted | 2ms | 2240 KiB | ||||
5 | Accepted | 2ms | 2488 KiB | ||||
6 | Wrong answer | 2ms | 2700 KiB | ||||
7 | Wrong answer | 2ms | 2900 KiB | ||||
8 | Wrong answer | 2ms | 2928 KiB | ||||
9 | Accepted | 2ms | 2928 KiB | ||||
10 | Wrong answer | 2ms | 2932 KiB | ||||
11 | Wrong answer | 2ms | 3180 KiB | ||||
subtask3 | 0/20 | ||||||
12 | Wrong answer | 2ms | 3132 KiB | ||||
13 | Wrong answer | 2ms | 3132 KiB | ||||
14 | Wrong answer | 2ms | 3268 KiB | ||||
15 | Wrong answer | 2ms | 3388 KiB | ||||
16 | Wrong answer | 2ms | 3412 KiB | ||||
17 | Wrong answer | 3ms | 3432 KiB | ||||
18 | Wrong answer | 3ms | 3656 KiB | ||||
19 | Wrong answer | 4ms | 3908 KiB | ||||
20 | Wrong answer | 3ms | 3984 KiB | ||||
21 | Wrong answer | 3ms | 3992 KiB | ||||
22 | Wrong answer | 2ms | 3964 KiB | ||||
subtask4 | 0/30 | ||||||
23 | Wrong answer | 14ms | 4940 KiB | ||||
24 | Wrong answer | 48ms | 6732 KiB | ||||
25 | Wrong answer | 123ms | 12692 KiB | ||||
26 | Wrong answer | 136ms | 13340 KiB | ||||
27 | Wrong answer | 137ms | 13288 KiB | ||||
28 | Wrong answer | 54ms | 8236 KiB | ||||
29 | Wrong answer | 10ms | 4872 KiB | ||||
30 | Wrong answer | 10ms | 4952 KiB | ||||
31 | Wrong answer | 6ms | 4604 KiB | ||||
subtask5 | 0/40 | ||||||
32 | Wrong answer | 17ms | 5496 KiB | ||||
33 | Wrong answer | 59ms | 7224 KiB | ||||
34 | Wrong answer | 114ms | 10572 KiB | ||||
35 | Wrong answer | 166ms | 13304 KiB | ||||
36 | Wrong answer | 185ms | 13696 KiB | ||||
37 | Wrong answer | 182ms | 13696 KiB | ||||
38 | Wrong answer | 94ms | 9712 KiB | ||||
39 | Wrong answer | 115ms | 13060 KiB | ||||
40 | Wrong answer | 28ms | 6804 KiB | ||||
41 | Wrong answer | 43ms | 7176 KiB |