| 记录编号 | 38314 | 评测结果 | AAAAAAAAAA | ||
|---|---|---|---|---|---|
| 题目名称 | 762.[USACO Open09] 奶牛队列 | 最终得分 | 100 | ||
| 用户昵称 | 是否通过 | 通过 | |||
| 代码语言 | C++ | 运行时间 | 0.994 s | ||
| 提交时间 | 2012-04-17 08:20:56 | 内存使用 | 1.03 MiB | ||
#include<iostream>
#include<fstream>
using namespace std;
int l[200000]={0};
int main()
{
ifstream fin("cline.in");
ofstream fout("cline.out");
int m,tou,c,wei,j=0;
tou=100001;
wei=100000;
char a,b;
fin>>m;
for (int i=1;i<=m;i++)
{
fin>>a;
if (a=='A')
{
string fei="";
fin>>b;
getline(fin,fei);
if (fei!="") { fei=""; continue;}
j++;
if (b=='L')
{
tou--;
l[tou]=j;
}
else
if (b=='R')
{
wei++;
l[wei]=j;
}
}
else
{
string fei="";
fin>>b>>c;
getline(fin,fei);
if (fei!=""){ fei=""; continue;}
if (b=='R')
{
wei=wei-c;
}
else
if (b=='L')
{
tou=tou+c;
}
}
}
for (int i=tou;i<=wei;i++)
{
fout<<l[i]<<endl;
}
fin.close();
fout.close();
return 0;
}