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 ...
随机推荐
- MongoDB安全:内置角色概览
官文列举如下(文档不长,过英语四级者可以轻松阅读,就不需要看本文额)(基于MongoDB 3.6的文档,4.0也没有变化): Role-Based Access Control Built-In Ro ...
- tensorflow中的boolean_mask
将mask中所有为true的抽取出来,放到一起,这里从n维降到1维度 tensor = [[1, 2], [3, 4], [5, 6]] import numpy as np mask=np.arra ...
- java基础27 单例集合Collection及其常用方法
1.集合 集合是存储对象数据的集合容器 1.1.集合比数组的优势 1.集合可以存储任意类型的数据,数组只能存储同一种数据类型的数据 2.集合的长度是变化的,数组的长度是固定的 1.2.数组:存储 ...
- (三)HtmlUnit 实践
第一节: htmlunit 爬取百度云资源
- Linux 命令find、grep
本文就向大家介绍find.grep命令,他哥俩可以算是必会的linux命令,我几乎每天都要用到他们.本文结构如下: find命令 find命令的一般形式 find命令的常用选项及实例 find与xar ...
- 20165203《Java程序设计》第九周学习总结
20165203<Java程序设计>第九周学习总结 教材学习内容总结 URL类 URL类是java.net包中的一个重要的类,URL的实例封装着一个统一资源定位符,使用URL创建对象的应用 ...
- PostgreSQL数据库如果不存在则插入,存在则更新
INSERT INTO UM_CUSTOMER(customercode,CompanyFlag,InputTime,LocalVersion) ) ON conflict(customercode) ...
- 使用Kafka、Elasticsearch、Grafana搭建业务监控系统(三)Elasticsearch
https://blog.csdn.net/tonywu1992/article/details/83576863
- java8 - 时间
import java.time.DayOfWeek; import java.time.Duration; import java.time.Instant; import java.time.Lo ...
- Spark(四)Spark之Transformation和Action
Transformation算子 基本的初始化 java static SparkConf conf = null; static JavaSparkContext sc = null; static ...