Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
33725 通过 【USACO】greetings C++ 通过 24 MS 8060 KB 551 2023-12-31 11:05:55

Tests(10/10):


#include <bits/stdc++.h> using namespace std; const int kMaxN=1e6+5; int B,E,x,bt=1,bx,et=1,ex,b[kMaxN],e[kMaxN],ans; char c; int main(){ cin>>B>>E; while(B--){ cin>>x>>c; while(x--){ if(c=='L')--bx; else ++bx; b[bt++]=bx; } } while(E--){ cin>>x>>c; while(x--){ if(c=='L')--ex; else ++ex; e[et++]=ex; } } while(bt>et){ e[et++]=ex; } while(et>bt){ b[bt++]=bx; } for(int i=1;i<bt;i++){ if(b[i]==e[i]&&b[i-1]!=e[i-1]){ ans++; } } cout<<ans; return 0; }


测评信息: