pku3664 Election Time
http://poj.org/problem?id=3664
水题
#include <stdio.h>
#include <map> using namespace std; map<pair<int, int>, int> map1;
map<pair<int, int>, int>::iterator it; int main()
{
int n, k;
int i, x, y, max1, flag1, temp;
while(~scanf("%d%d", &n, &k))
{
map1.clear();
max1 = ;
flag1 = ;
for(i=; i<=n; i++)
{
scanf("%d %d", &x, &y);
map1.insert(make_pair(make_pair(x, y), i));
if(map1.size() > k)
{
map1.erase(map1.begin());
}
}
for(it=map1.begin(); it!=map1.end(); it++)
{
temp = ((*it).first).second;
if(temp > max1)
{
max1 = temp;
flag1 = (*it).second;
}
}
printf("%d\n", flag1);
}
return ;
}
pku3664 Election Time的更多相关文章
- [译]ZOOKEEPER RECIPES-Leader Election
选主 使用ZooKeeper选主的一个简单方法是,在创建znode时使用Sequence和Ephemeral标志.主要思想是,使用一个znode,比如"/election",每个客 ...
- hihoCoder 1426 : What a Ridiculous Election(总统夶选)
hihoCoder #1426 : What a Ridiculous Election(总统夶选) 时间限制:1000ms 单点时限:1000ms 内存限制:256MB Description - ...
- berkeley db replica机制 - election algorithm
repmgr_method.c, __repmgr_start_int() 初始2个elect线程. repmgr_elect.c, __repmgr_init_election() __repmgr ...
- Election Time
Election Time Time Limit: 1000MS Memory limit: 65536K 题目描述 The cows are having their first election ...
- zookeeper 集群 Cannot open channel to X at election address Error contacting service. It is probably not running.
zookeeper集群 启动 1.问题现象. 启动每一个都提示 STARTED 但是查看 status时全部节点都报错 [root@ip-172-31-19-246 bin]# sh zkSer ...
- bzoj1675 [Usaco2005 Feb]Rigging the Bovine Election 竞选划区
Description It's election time. The farm is partitioned into a 5x5 grid of cow locations, each of wh ...
- 1675: [Usaco2005 Feb]Rigging the Bovine Election 竞选划区(题解第二弹)
1675: [Usaco2005 Feb]Rigging the Bovine Election 竞选划区 Time Limit: 5 Sec Memory Limit: 64 MBSubmit: ...
- 1675: [Usaco2005 Feb]Rigging the Bovine Election 竞选划区(题解第一弹)
1675: [Usaco2005 Feb]Rigging the Bovine Election 竞选划区 Time Limit: 5 Sec Memory Limit: 64 MBSubmit: ...
- A Bayesian election prediction, implemented with R and Stan
If the media coverage is anything to go by, people are desperate to know who will win the US electio ...
随机推荐
- IO(一)
文件相关 package com.bjsxt.io.file; import java.io.File; /** * 两个常量 * 1.路径分隔符 ; * 2.名称分隔符 /(windows) /(l ...
- BZOJ 2727 双十字(树状数组)
题目链接:http://61.187.179.132/JudgeOnline/problem.php?id=2727 题意: 思路:思路来自这里.首先对于每个位置(i,j)用C[i][j]表示该位置同 ...
- 在C#中dagagridview绑定list泛型
今天在项目中由于需要使用到datagridview绑定list的数据源,在针对list的添加.删除.修改都可以很好地完成,可是在初始化datagridview时,却发现了问题,绑定数据源后,并没有在列 ...
- asp.net页面过滤所有换行符和多余空格
不知道大家注意到了没有,Google和Baidu网页的HTML源代码是混合在一起的.HTML代码混合在一起,出发点是为了减小网页体积,从而加快网页加载速度. 写个函数把网页HTML源代码的换行符和空格 ...
- 概述hibernate入门安装配置
1.jdbc连接的优缺点 JDBC的优点 直接底层操作,提供了很简单.便捷的访问数据库的方法,跨平台性比较强.灵活性比较强,可以写很复杂的SQL语句. JDBC的缺点 1).因为JAVA是面向对象的, ...
- pl/sql programming 02 创建并运行plsql代码
/* * chap 02 * ------------------------------------------------- */ create or replace function wordc ...
- D3D中深度测试和Alpha混合的关系
我在学习D3D的深度测试和Alpha混合的时候,有一些遗憾.书上提供的例子里说一定要先渲染不透明物体,再渲染透明物体,对渲染状态的设置也有特殊要求.我看的很晕.自己查图形学的书,上网找资料,结果还是糊 ...
- rsync常用命令及格式
rsync在同步文件夹内容这个工作上应用非常广泛,但是rsync本身命令还是比较复杂,本文总结一下: rsync = remote sync的简称 ,它 被用于在linux/unix系统中执行备份操作 ...
- 51nod1349 最大值
还是傻叉单调栈 #include<cstdio> #include<cstring> #include<cctype> #include<algorithm& ...
- memcached增删改查
1)add语法:add key flag expire byteskey 键flag 标志expire 过期时间,可以是秒或一个具体的时间戳bytes 要存的东西的bytes长度 PS:只能添加内存里 ...