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 ...
随机推荐
- Prepare tasks for django project deployment.md
As we know, there are some boring tasks while deploy Django project, like create db, do migrations a ...
- Jenkins+Ant+TestNG+Testlink自动化构建集成
这段时间折腾自动化测试,之前都是在Eclipse工程里面手工执行自动化测试脚本,调用Testlink API执行测试用例,目前搭建Jenkins自动化构建测试的方式,实现持续构建,执行自动化测试. 硬 ...
- ntp/系统时钟/硬件时钟/双系统下计算机时间读取的问题
http://blog.chinaunix.net/uid-182041-id-3464524.html //linux系统时间和硬件时钟问题(date和hwclock) http://j ...
- mysql高可用架构 -> MHA配置VIP漂移-05
VIP漂移的两种方式 1)通过keepalived的方式,管理虚拟IP的漂移 2)通过MHA自带脚本方式,管理虚拟IP的漂移 MHA脚本方式 虚拟ip漂移的脚本下载地址 -> wget http ...
- Ubuntu下使用virtualenv
Ubuntu 18.04,Python 3.6.5(最新3.7),virtualenv 16.0.0, 即将在Ubuntu上大张旗鼓地干活啦!那么,将之前安装的virtualenv运行起来吧(前面都是 ...
- 基于timestamp和nonce的防止重放攻击方案
参考:http://blog.csdn.net/koastal/article/details/53456696
- JQuery中DOM事件合成用法
jQuery有两个合成事件——hover()方法和toggle()方法 类似前面讲过的ready()方法,hover()方法和toggle()方法都属于jQuery自定义的方法. hover()方法: ...
- Java容器---Set: HashSet & TreeSet & LinkedHashSet
1.Set接口概述 Set 不保存重复的元素(如何判断元素相同呢?).如果你试图将相同对象的多个实例添加到Set中,那么它就会阻止这种重复现象. Set中最常被使用的是测试归属性,你可以 ...
- springMVC源码分析--HttpMessageConverter数据转化(一)
之前的博客我们已经介绍了很多springMVC相关的模块,接下来我们介绍一下springMVC在获取参数和返回结果值方面的处理.虽然在之前的博客老田已经分别介绍了参数处理器和返回值处理器: (1)sp ...
- Python学习笔记:出生日期转化为年龄
在数据挖掘项目中,有时候个体的出生日期包含信息量过大,不适合作为一个有效数据进入模型算法训练,因此有必要把出生日期转化为年龄age,age是一个很好的特征工程指示变量. import pandas a ...