2507 | 2023-01-15 11:22:27 | HorakZsofi | Videójáték | cpp11 | Wrong answer 10/100 | 180ms | 7368 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;
}
}
}
cout<<megoldas;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1812 KiB | ||||
2 | Accepted | 2ms | 2020 KiB | ||||
subtask2 | 10/10 | ||||||
3 | Accepted | 2ms | 2268 KiB | ||||
4 | Accepted | 2ms | 2504 KiB | ||||
5 | Accepted | 2ms | 2652 KiB | ||||
6 | Accepted | 2ms | 2696 KiB | ||||
7 | Accepted | 2ms | 2676 KiB | ||||
8 | Accepted | 2ms | 2768 KiB | ||||
9 | Accepted | 2ms | 2848 KiB | ||||
10 | Accepted | 2ms | 3092 KiB | ||||
11 | Accepted | 2ms | 3172 KiB | ||||
subtask3 | 0/20 | ||||||
12 | Wrong answer | 2ms | 3192 KiB | ||||
13 | Accepted | 2ms | 3304 KiB | ||||
14 | Wrong answer | 2ms | 3308 KiB | ||||
15 | Wrong answer | 2ms | 3332 KiB | ||||
16 | Wrong answer | 2ms | 3376 KiB | ||||
17 | Wrong answer | 3ms | 3408 KiB | ||||
18 | Wrong answer | 3ms | 3480 KiB | ||||
19 | Wrong answer | 4ms | 3492 KiB | ||||
20 | Wrong answer | 3ms | 3484 KiB | ||||
21 | Wrong answer | 3ms | 3484 KiB | ||||
22 | Wrong answer | 2ms | 3504 KiB | ||||
subtask4 | 0/30 | ||||||
23 | Wrong answer | 14ms | 3844 KiB | ||||
24 | Wrong answer | 48ms | 4472 KiB | ||||
25 | Wrong answer | 122ms | 6360 KiB | ||||
26 | Wrong answer | 136ms | 6752 KiB | ||||
27 | Wrong answer | 141ms | 7012 KiB | ||||
28 | Wrong answer | 52ms | 5400 KiB | ||||
29 | Wrong answer | 10ms | 4356 KiB | ||||
30 | Wrong answer | 9ms | 4352 KiB | ||||
31 | Accepted | 6ms | 4300 KiB | ||||
subtask5 | 0/40 | ||||||
32 | Wrong answer | 16ms | 4532 KiB | ||||
33 | Wrong answer | 59ms | 5424 KiB | ||||
34 | Wrong answer | 112ms | 6500 KiB | ||||
35 | Wrong answer | 159ms | 6972 KiB | ||||
36 | Wrong answer | 180ms | 7364 KiB | ||||
37 | Wrong answer | 180ms | 7368 KiB | ||||
38 | Wrong answer | 93ms | 6396 KiB | ||||
39 | Wrong answer | 114ms | 6720 KiB | ||||
40 | Accepted | 28ms | 5088 KiB | ||||
41 | Wrong answer | 43ms | 5616 KiB |