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 ...
随机推荐
- 51nod 1092 回文字符串 (dp)
http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1092 这个题是poj-3280的简化版,这里只可以增加字符,设 dp[i ...
- STL容器的遍历删除
STL容器的遍历删除 今天在对截包程序的HashTable中加入计时机制时,碰到这个问题.对hash_map中的每个项加入时间后,用查询函数遍历hash_map,以删除掉那些在表存留时间比某个阈值长的 ...
- windows平台时间函数性能比较QueryPerformanceCounter,GetTickCount,ftime,time,GetLocalTime,GetSystemTimeAsFileTime
http://gmd20.blog.163.com/blog/static/168439232012113111759514/ 执行 10000000 次, 耗时 2258,369 微秒 Qu ...
- arithmetic-slices-ii-subsequence(太难了)
https://leetcode.com/problems/arithmetic-slices-ii-subsequence/ 太难了... package com.company; import j ...
- jsp之EL表达式
1.null值 null值会用""进行显示 2.隐式对象 1).pageScope.requestScope(相当于request).sessionScope(相当于session ...
- [转] POJ DP问题
列表一:经典题目题号:容易: 1018, 1050, 1083, 1088, 1125, 1143, 1157, 1163, 1178, 1179, 1189, 1191,1208, 1276, 13 ...
- (转载)ios关闭虚拟键盘的几种方法
在iOS应用开发中,有三类视图对象会打开虚拟键盘,进行输入操作,但如何关闭虚拟键盘,却没有提供自动化的方法.这个需要我们自己去实现.这三类视图对象分别是UITextField,UITextView和U ...
- java之IO
IO流主要用于硬板.内存.键盘等处理设备上得数据操作 一.IO流分类 java.io包中定义了多个流类型(类或抽象类)来实现输入/输出功能,可以从不同角度对其分类: 1.按数据流的方向不同分为:输入流 ...
- Android程序架构基本内容概述
在Android操作系统中开发的应用程序都有一个结构缜密的架构.我们今天就来对这一Android程序架构做一个详细的分析.帮助大家了解程序开发的特点,以方便将来在应用程序开中明确自己的程序架构. An ...
- django - raw sql - 注意点!
现在的自己已经不怕mysql,已经熟悉了sql “搜索优化专家有时候都无法顾全所有,更何况ORM” 两种方法执行 sql原生语句 tablename.objects.raw() - 这样的语句,只能执 ...