卡了我几个月了……
[![](https://cdn.luogu.com.cn/upload/image_hosting/a3ogbn0h.png?x-oss-process=image/resize,m_lfit,h_300,w_500)](https://cdn.luogu.com.cn/upload/image_hosting/a3ogbn0h.png?x-oss-process=image/resize,m_lfit,h_170,w_225)
by aqx_AK_xyf @ 2021-10-02 22:16:32
核心代码:
```cpp
n=read(),m=read();
for(int i=1;i<=n;i++){
int v=read(),t=read();
while(t--)a[++cnt]=v;
}
cnt=0;
for(int i=1;i<=m;i++){
int v=read(),t=read();
while(t--)b[++cnt]=v;
}
for(int i=1;i<=cnt;i++){
sa+=a[i],sb+=b[i];
if(sa>sb&&flag==1)ans++;
if(sa<sb&&flag==2)ans++;
if(sa>sb)flag=2;
if(sa<sb)flag=1;
//puts("");
//print(sa,' '),print(sb,' '),print(flag,' ');
}
print(ans,'\n');
```
by aqx_AK_xyf @ 2021-10-02 22:17:55
会不会出现并排跑一段路的情况啊
比如
```cpp
2 2
2 5
2 10
2 5
3 10
```
此时答案应该是 $1$ 吧
by Carnival @ 2021-10-02 22:21:54
@[Gamemode](/user/316300) 还是 $60pts$
by aqx_AK_xyf @ 2021-10-02 22:27:36
@[Gamemode](/user/316300) 而且题解也是 $0$
by aqx_AK_xyf @ 2021-10-02 22:36:46
下的数据太大了,有人能给一组小的吗
by aqx_AK_xyf @ 2021-10-02 22:37:34
……数组开的 $1005$,结果他给 WA,而不是 RE……本帖终
by aqx_AK_xyf @ 2021-10-02 22:40:26