Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
33999 | U•ェ•*✔ | 【USACO】greetings | C++ | 通过 | 24 MS | 8064 KB | 673 | 2023-12-31 15:18:52 |
#include"bits/stdc++.h" using namespace std; int a[1000000],b[1000000]; int main(){ int n,m,t1=0,p1=0,t2=0,p2=0,x,ans=0; char y; cin>>n>>m; for(int i=1;i<=n;i++){ cin>>x>>y; if(y=='L'){ while(x--){ t1--; p1++; a[p1]+=t1; } } else{ while(x--){ t1++; p1++; a[p1]+=t1; } } } for(int i=1;i<=m;i++){ cin>>x>>y; if(y=='L'){ while(x--){ t2--; p2++; b[p2]+=t2; } } else{ while(x--){ t2++; p2++; b[p2]+=t2; } } } for(int i=1;i<=1000000;i++){ if(i>p1)a[i]=t1; if(i>p2)b[i]=t2; if(a[i]==b[i]&&a[i-1]!=b[i-1])ans++; } cout<<ans; }