#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
struct xxx
{
int p,d;
}a[];
int n,l;
bool f[];
int main()
{
while (~scanf("%d%d",&n,&l))
{
if (n==&&l==) break;
for (int i=;i<=n;i++)
{
char s[];
scanf("%s",s);
scanf("%d",&a[i].p);
if (s[]=='R') a[i].d=;
else a[i].d=;
}
int ti=,tot=n;
memset(f,,sizeof(f));
int ans;
while (tot)
{
ti++;
for (int i=;i<=n;i++)
if (!f[i])
{
if (a[i].d==) a[i].p++;
else a[i].p--;
}
for (int i=;i<=n;i++)
if (!f[i])
{
if (a[i].p>=l)
{
ans=i;
f[i]=;
tot--;
}
}
for (int i=;i<=n;i++)
if (!f[i])
{
if (a[i].p<)
{
ans=i;
f[i]=;
tot--;
}
}
for (int i=;i<=n;i++)
for (int j=i+;j<=n;j++)
if (a[i].p==a[j].p)
{
a[i].d^=;
a[j].d^=;
}
}
printf("%d %d\n",ti,ans);
}
return ;
}

UVALive 6662 TheLastAnt的更多相关文章

  1. UVALive - 4108 SKYLINE[线段树]

    UVALive - 4108 SKYLINE Time Limit: 3000MS     64bit IO Format: %lld & %llu Submit Status uDebug ...

  2. UVALive - 3942 Remember the Word[树状数组]

    UVALive - 3942 Remember the Word A potentiometer, or potmeter for short, is an electronic device wit ...

  3. UVALive - 3942 Remember the Word[Trie DP]

    UVALive - 3942 Remember the Word Neal is very curious about combinatorial problems, and now here com ...

  4. 思维 UVALive 3708 Graveyard

    题目传送门 /* 题意:本来有n个雕塑,等间距的分布在圆周上,现在多了m个雕塑,问一共要移动多少距离: 思维题:认为一个雕塑不动,视为坐标0,其他点向最近的点移动,四舍五入判断,比例最后乘会10000 ...

  5. UVALive 6145 Version Controlled IDE(可持久化treap、rope)

    题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_ ...

  6. UVALive 6508 Permutation Graphs

    Permutation Graphs Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit ...

  7. UVALive 6500 Boxes

    Boxes Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit Status Pract ...

  8. UVALive 6948 Jokewithpermutation dfs

    题目链接:UVALive 6948  Jokewithpermutation 题意:给一串数字序列,没有空格,拆成从1到N的连续数列. dfs. 可以计算出N的值,也可以直接检验当前数组是否合法. # ...

  9. 【暑假】[实用数据结构]UVAlive 3135 Argus

    UVAlive 3135 Argus Argus Time Limit: 3000MS   Memory Limit: Unknown   64bit IO Format: %lld & %l ...

随机推荐

  1. Ubuntu 12.04下LVM2安装和操作实验

    实验环境: VirtualBox v4.3.20 Lubuntu 12.04LTS 前期准备: 1.添加虚拟盘:菜单"控制"->"设置"->&quo ...

  2. 蛮力法解决0_1背包问题新思路-——利用C语言位域类型

    废话不说了,直接上代码 #include<stdio.h> #include<math.h> #define N 5 //物品种类数目 #define CAPACITY 6 / ...

  3. 程序设计分层思想和DAO设计模式的开发

    无论是一个应用程序项目还是一个Web项目,我们都可以按照分层思想进行程序设计.对于分层,当下最流行划分方式是:表现层+控制层+业务层+数据层.其中,业务层和数据层被统称为后台业务层,而表现层和控制层属 ...

  4. DevExpress 去除皮肤的方法

    我从不用皮肤,方法如下:

  5. CI框架整合UEditor编辑器上传功能

    最近项目中要使用到富文本编辑器,选用了功能强大的UEditor,接下来就来讲讲UEditor编辑器的上传功能整合. 本文UEditor版本:ueditor1_4_3_utf8_php版本 第一步:部署 ...

  6. 微信接口问题(The underlying connection was closed: An unexpected error occurred on a send)

    突然在调用微信接口是报:The underlying connection was closed: An unexpected error occurred on a send错误,跟踪了半天,是因为 ...

  7. moment.js笔记

    增加日期时间 moment().add(Number, String); moment().add(Duration); moment().add(Object); 添加天数: moment().ad ...

  8. 【POJ】1026.Cipher

    题解 置换群的快速幂,然而我姿势水平不高,样例过不去,然后才明白这个置换的意思是这个位置上的数代表要把原位置的某个数换过来 需要新开一个数组存结果 代码 #include <iostream&g ...

  9. loadrunner——常见函数

    loadrunner——常见函数 分类: LoadRunner 2012-04-11 20:41 703人阅读 评论(0) 收藏 举报 loadrunnersearchweb服务器脚本stringwe ...

  10. pomelo 安装

    1. 安装nodejs ,python ,C++运行环境(VS2012以上版本) 2.npm install -g node-gyp --registry=https://registry.npm.t ...