2508 | 2023-01-15 11:29:36 | Zoli9 | Videójáték | cpp17 | Wrong answer 10/100 | 185ms | 7240 KiB |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t, n;
cin>>t>>n;
vector<pair<int, int>> fsz(n+1);
for(int i=1; i<n+1; i++){
cin>>fsz[i].first;
cin>>fsz[i].second;
}
int m;
cin>>m;
vector<pair<int, int>> haha(m+1);
for(int i=1; i<m+1; i++){
cin>>haha[i].first;
cin>>haha[i].second;
}
int megoldas=0;
int hszaml=1;
for(int i=1; i<n+1; i++) {
//itt megjön a főszereplő az i. szünetre
/*
amíg hszaml szünet intervallum az túl kicsi, addig fellépegetünk
...utána most már a közös szünetes dolgokat vizsgáljuk
...és utána ha elment a főszereplő, vagy már túl messze van a hszaml szünet, akkor kilépünk
*/
while(hszaml<=m && haha[hszaml].second<fsz[i].first){
hszaml++;
}
if(hszaml>m) {
break;
}
int fszido=fsz[i].first;
while(1) {
if(haha[hszaml].first>fsz[i].second){
break;
}
if(fszido+t+1<haha[hszaml].first){
break;
}
int mini=min(haha[hszaml].second, fsz[i].second);
int maxi=max(haha[hszaml].first, fszido);
megoldas+=mini-maxi+1;
hszaml++;
fszido=mini+1;
if(hszaml>m) {
break;
}
}
if(hszaml>m) {
break;
}
}
cout<<megoldas;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1816 KiB | ||||
2 | Accepted | 2ms | 2048 KiB | ||||
subtask2 | 10/10 | ||||||
3 | Accepted | 2ms | 2208 KiB | ||||
4 | Accepted | 2ms | 2452 KiB | ||||
5 | Accepted | 2ms | 2652 KiB | ||||
6 | Accepted | 2ms | 2904 KiB | ||||
7 | Accepted | 2ms | 3144 KiB | ||||
8 | Accepted | 2ms | 3224 KiB | ||||
9 | Accepted | 2ms | 3136 KiB | ||||
10 | Accepted | 2ms | 3140 KiB | ||||
11 | Accepted | 2ms | 3136 KiB | ||||
subtask3 | 0/20 | ||||||
12 | Wrong answer | 2ms | 3412 KiB | ||||
13 | Accepted | 2ms | 3516 KiB | ||||
14 | Wrong answer | 2ms | 3508 KiB | ||||
15 | Wrong answer | 3ms | 3636 KiB | ||||
16 | Wrong answer | 2ms | 3572 KiB | ||||
17 | Wrong answer | 3ms | 3532 KiB | ||||
18 | Wrong answer | 3ms | 3540 KiB | ||||
19 | Wrong answer | 4ms | 3672 KiB | ||||
20 | Wrong answer | 3ms | 3748 KiB | ||||
21 | Wrong answer | 3ms | 3872 KiB | ||||
22 | Wrong answer | 2ms | 3996 KiB | ||||
subtask4 | 0/30 | ||||||
23 | Wrong answer | 14ms | 4500 KiB | ||||
24 | Wrong answer | 48ms | 5052 KiB | ||||
25 | Wrong answer | 120ms | 6788 KiB | ||||
26 | Wrong answer | 135ms | 6980 KiB | ||||
27 | Wrong answer | 135ms | 6980 KiB | ||||
28 | Wrong answer | 52ms | 5424 KiB | ||||
29 | Wrong answer | 10ms | 4368 KiB | ||||
30 | Wrong answer | 9ms | 4364 KiB | ||||
31 | Accepted | 6ms | 4472 KiB | ||||
subtask5 | 0/40 | ||||||
32 | Wrong answer | 16ms | 4540 KiB | ||||
33 | Wrong answer | 59ms | 5220 KiB | ||||
34 | Wrong answer | 112ms | 6196 KiB | ||||
35 | Wrong answer | 159ms | 6868 KiB | ||||
36 | Wrong answer | 181ms | 7240 KiB | ||||
37 | Wrong answer | 185ms | 7240 KiB | ||||
38 | Wrong answer | 93ms | 6200 KiB | ||||
39 | Wrong answer | 112ms | 6708 KiB | ||||
40 | Accepted | 28ms | 4772 KiB | ||||
41 | Wrong answer | 43ms | 5080 KiB |