UVALive 6662 TheLastAnt
#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的更多相关文章
- UVALive - 4108 SKYLINE[线段树]
UVALive - 4108 SKYLINE Time Limit: 3000MS 64bit IO Format: %lld & %llu Submit Status uDebug ...
- UVALive - 3942 Remember the Word[树状数组]
UVALive - 3942 Remember the Word A potentiometer, or potmeter for short, is an electronic device wit ...
- UVALive - 3942 Remember the Word[Trie DP]
UVALive - 3942 Remember the Word Neal is very curious about combinatorial problems, and now here com ...
- 思维 UVALive 3708 Graveyard
题目传送门 /* 题意:本来有n个雕塑,等间距的分布在圆周上,现在多了m个雕塑,问一共要移动多少距离: 思维题:认为一个雕塑不动,视为坐标0,其他点向最近的点移动,四舍五入判断,比例最后乘会10000 ...
- UVALive 6145 Version Controlled IDE(可持久化treap、rope)
题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_ ...
- UVALive 6508 Permutation Graphs
Permutation Graphs Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit ...
- UVALive 6500 Boxes
Boxes Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit Status Pract ...
- UVALive 6948 Jokewithpermutation dfs
题目链接:UVALive 6948 Jokewithpermutation 题意:给一串数字序列,没有空格,拆成从1到N的连续数列. dfs. 可以计算出N的值,也可以直接检验当前数组是否合法. # ...
- 【暑假】[实用数据结构]UVAlive 3135 Argus
UVAlive 3135 Argus Argus Time Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %l ...
随机推荐
- 管道和xargs区别
一直弄不懂,管道不就是把前一个命令的结果作为参数给下一个命令吗,那在 | 后面加不加xargs有什么区别 NewUserFF 写道: 懒蜗牛Gentoo 写道: 管道是实现“将前面的标准输出作为后面的 ...
- aarch64_o2
opensips-event_rabbitmq-2.2.3-1.fc26.aarch64.rpm 2017-03-10 01:22 42K fedora Mirroring Project opens ...
- java 读取配置文件类
import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; im ...
- html-介绍
一:概述 HTML是英文Hyper Text Mark-up Language(超文本标记语言)的缩写,他是一种制作万维网页面标准语言(标记).相当于定义统一的一套规则,大家都来遵守他,这样就可以让浏 ...
- GitHub如何使用
先马克一下,有空看看:http://blog.csdn.net/xiahouzuoxin/article/details/9393119
- AdvStringGrid 垂直居中 、水平居中
官网faq,解答: 结果:
- Centos之链接命令
链接命令:ln (link) ln -s [源文件] [目标文件] 功能描述:生成链接文件 选项: -s 创建软链接 硬链接特征: 1,拥有相同的i节点和存储block块,可以看作是同一个文件: 2 ...
- mdb数据库文件如何导入Microsoft SQL Server 2008中
1.在‘开始’菜单打开‘Microsoft SQL Server 2008→SQL Server Management Studio’. 2.新建一个数据库(名称自定义),选择新建的数据库点击右键选择 ...
- 使用mybatis-generator-core自动生成代码
SSM框架可以使用mybatis-generator-core-1.3.2.jar来自动生成代码,以下是配置和使用的代码. generatorConfig.xml <?xml version=& ...
- CCF CSP 201703-2 学生排队
博客中的文章均为meelo原创,请务必以链接形式注明本文地址 CCF CSP 201703-2 学生排队 问题描述 体育老师小明要将自己班上的学生按顺序排队.他首先让学生按学号从小到大的顺序排成一排, ...