#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. wifi两种工作模式

    AP:即无线接入点,是一个无线网络的中心节点.通常使用的无线路由器就是一个AP,其它无线终端 可以通过AP相互连接. STA:即无线站点,是一个无线网络的终端.如笔记本电脑.PDA等. 1>工作 ...

  2. java中Cookie使用问题(message:invalid character [32] was present in the Cookie value)

    1. 问题描述 Servlet中执行下面一段代码: public void doGet(HttpServletRequest request, HttpServletResponse response ...

  3. 将ipa文件安装到测试设备上的几种方法

    Installing Your App on Test Devices Using Xcode You can install iOS App files on devices using Xcode ...

  4. Python_oldboy_自动化运维之路_全栈考试(五)

    1.执行 Python 脚本的两种方式 [root@localhost tmp]# cat a.py #!/usr/bin/python # -*- coding: UTF-8 -*- print & ...

  5. 使用插件实现Jenkins参数化构建

    一.插件安装 1.打开插件管理,在此界面可以安装插件 二.参数化 1.在“可选插件”中查找如下两个插件然后安装,安装后重启Jenkins Build With Parameters 输入框式的参数 P ...

  6. Unix IPC之pipe

    pipe创建函数: #include <unistd.h> /* Create a one-way communication channel (pipe). If successful, ...

  7. sql server 约束 查找

    --1.主键约束 SELECT tab.name AS [表名], idx.name AS [主键名称], col.name AS [主键列名] FROM sys.indexes idx JOIN s ...

  8. 插入标识列identity_insert

    插入标识列identity_insert 在进行数据插入时,如果插入列名包括标识列,常常会遇到以下3种提示: 一.“当 IDENTITY_INSERT 设置为 OFF 时,不能向表 'xxxxxxxx ...

  9. MySQL学习笔记:insert into select

    从一个表复制数据插入到另外一个表,目标表中任何已存在的行都不会受影响. 语法: INSERT INTO table_xxx VALUES(); INSERT INTO table_xxx SELECT ...

  10. asp.net 微信公众号源码

    需要源码,请加QQ:858-048-581 功能菜单 该源码功能十分的全面,具体介绍如下:1.菜单回复:微信自定义回复.关注时回复.默认回复.文本回复.图文回复.语音回复. 请求回复记录.LBS位置回 ...