2012.6辽宁省赛 Problem F
来源:互联网 发布:linux进入命令行 编辑:程序博客网 时间:2024/05/01 11:28
自己模拟了,没有交过,不知道是否正确。
#include<iostream>#include<queue>#include<stack>#define max 10using namespace std;int main(){ queue<int>player1; queue<int>player2; stack<int>table; bool ontable[max]; int n,m,times,i,data,temp; while(cin>>n>>m>>times) { for(i=0;i<n;i++) { cin>>data; player1.push(data); } for(i=0;i<m;i++) { cin>>data; player2.push(data); } for(i=0;i<times;i++) { if(i%2==0) { if(!ontable[player1.front()]) { ontable[player1.front()]=1; table.push(player1.front()); player1.pop(); } else { temp=player1.front(); player1.push(temp); player1.pop(); while(table.top()!=temp) { player1.push(table.top()); table.pop(); } player1.push(table.top()); table.pop(); ontable[player1.front()]=0; } } else { if(!ontable[player2.front()]) { ontable[player2.front()]=1; table.push(player2.front()); player2.pop(); } else { temp=player2.front(); player2.push(temp); player2.pop(); while(table.top()!=temp) { cout<<player2.back()<<endl; player2.push(table.top()); table.pop(); } player2.push(table.top()); table.pop(); ontable[player2.front()]=0; } } } cout<<player1.size()<<" "<<player2.size()<<endl; } return 0;}
- 2012.6辽宁省赛 Problem F
- 辽宁省赛——杨鲁斯卡尔专场 -F
- 2014辽宁省ACM程序设计大赛网络赛 Problem A: Decryption
- 辽宁省赛2010
- 2014辽宁省赛 Traveling
- 辽宁省赛总结
- 辽宁省赛2010
- 辽宁省赛2010 G
- dut oj1192 Problem G(2012辽宁省赛G题 树状数组)
- Problem F
- ProBlem F
- Problem F
- Problem F
- Problem F
- Problem F
- problem F
- Problem f
- Problem F
- Android 下拉列表 Spinner
- mysql入门篇2——常用数据字典信息
- 以太网类型码(Ethernet type codes)
- A盾 (A-Protect) 枚举进程的一个bug
- adobe flash player设置时无法点击允许的解决方法
- 2012.6辽宁省赛 Problem F
- web安全色
- 在我的心目中freeeim
- 构造函数
- NCBI SRA格式转换
- API总结2
- C++------对文件的操作(初学)
- MapXtreme 2005 一些问题(八)
- 第一步:把用鼠标画出的坐标点存到一个文件中