记录编号 578370 评测结果 AAAAAAAAAA
题目名称 [NOIP 2003]乒乓球 最终得分 100
用户昵称 Gravatarムラサメ 是否通过 通过
代码语言 C++ 运行时间 0.010 s
提交时间 2023-03-10 07:21:48 内存使用 0.59 MiB
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
queue<pair<int,int> > q,p;
string s;
int w1=0,w2=0,l1=0,l2=0;
void write(){
	while(!q.empty()){
		cout<<q.front().first<<":"<<q.front().second<<endl;
		q.pop();
	}
	cout<<endl;
	while(!p.empty()){
		cout<<p.front().first<<":"<<p.front().second<<endl;
		p.pop();
	}
}
int main(){
	freopen("table.in","r",stdin);
	freopen("table.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	while(1){
		cin>>s;
		for(int i=0;i<s.length();i++){
			if(s[i]=='E'){
				q.push({w1,l1});
				p.push({w2,l2});
				write();
				return 0;
			}
			else{
				if(s[i]=='W'){
					w1++;
					w2++;
				}
				else{
					l1++;
					l2++;
				}
			}
			if(w1>=11&&w1-l1>=2||l1>=11&&l1-w1>=2){
				q.push(make_pair(w1,l1));
				w1=0;
				l1=0;
			}
			if(w2>=21&&w2-l2>=2||l2>=21&&l2-w2>=2){
				p.push(make_pair(w2,l2));
				w2=0;
				l2=0;
			}
		}
	}
    return 0;
}