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的更多相关文章

  1. [译]ZOOKEEPER RECIPES-Leader Election

    选主 使用ZooKeeper选主的一个简单方法是,在创建znode时使用Sequence和Ephemeral标志.主要思想是,使用一个znode,比如"/election",每个客 ...

  2. hihoCoder 1426 : What a Ridiculous Election(总统夶选)

    hihoCoder #1426 : What a Ridiculous Election(总统夶选) 时间限制:1000ms 单点时限:1000ms 内存限制:256MB Description - ...

  3. berkeley db replica机制 - election algorithm

    repmgr_method.c, __repmgr_start_int() 初始2个elect线程. repmgr_elect.c, __repmgr_init_election() __repmgr ...

  4. Election Time

    Election Time Time Limit: 1000MS Memory limit: 65536K 题目描述 The cows are having their first election ...

  5. 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 ...

  6. 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 ...

  7. 1675: [Usaco2005 Feb]Rigging the Bovine Election 竞选划区(题解第二弹)

    1675: [Usaco2005 Feb]Rigging the Bovine Election 竞选划区 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit:  ...

  8. 1675: [Usaco2005 Feb]Rigging the Bovine Election 竞选划区(题解第一弹)

    1675: [Usaco2005 Feb]Rigging the Bovine Election 竞选划区 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit:  ...

  9. 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 ...

随机推荐

  1. win7下制作ubuntu系统安装启动盘和U盘安装ubuntu全过程

    在我搞坏了两个系统之后,一切都得从头开始了,这回好了,电脑就是一台裸机了.没办法,重新下win7吧.这个要先做一个win7的启动盘,然后再安装,只能说我技术不行,没能把win7搞定.让大神给装的win ...

  2. ios用户控件

    22:48:452015-03-16说道用控件,很地东方都在用.用好了,可以加快开发进度,提高可维护性,程序的稳定,健壮性,用不好,也可以提高经验值啊,下次就好了,算是学习成本吧. 不同语言,不同项目 ...

  3. BZOJ 3170 松鼠聚会(XY坐标)

    题目链接:http://61.187.179.132/JudgeOnline/problem.php?id=3170 题意:给出二维平面上n个点 (xi,yi).求一点t(1<=t<=n) ...

  4. 基于Linux的oracle数据库管理 part5( linux启动关闭 自动启动关闭 oracle )

    主要内容 1. 数据库自动启动与关闭 数据库自动启动与关闭 - 单数据库模式 启动监听器及数据库 启动脚本: #! /bin/bash su - oracle<<EOF lsnrctl s ...

  5. HeadFirst 12 (web应用安全)

    测试领域可以使用的方法,在tomcat-users.xml 中设置授权, 为什么这个不能在生产环境中呢, 因为如果这个设置在生产环境中, 那么当你想修改”授权时”, 就要修改这个xml文件, 那么就要 ...

  6. HeadFirst jsp 03 (MVC)

    创建一个小的 web 应用, mvc, 麻雀虽小, 五脏俱全 补1: servlet没有main()方法, 他们受控与另外一个Java应用, 这个Java应用称为 容器, tomcat就是这么一个容器 ...

  7. JavaScript关闭窗口的方法

    当你创建了一个新窗口时,将open()方法的返回值分配给一个变量非常重要.比如,下面的语句就是创建一个新窗口,然后立即关闭它: win = window.open("http://www.d ...

  8. JavaScript判断浏览器类型及版本

    JavaScript是前端开发的主要语言,我们可以通过编写JavaScript程序来判断浏览器的类型及版本.JavaScript判断浏览器类型一般有两种办法,一种是根据各种浏览器独有的属性来分辨,另一 ...

  9. 1038: [ZJOI2008]瞭望塔

    半平面交. 半平面指的就是一条直线的左面(也不知道对不对) 半平面交就是指很多半平面的公共部分. 这道题的解一定在各条直线的半平面交中. 而且瞭望塔只可能在各个点或者半平面交折线的拐点处. 求出半平面 ...

  10. HTML元素margin、padding的默认值

    HTML元素margin.padding的默认值 element margin(单位像素) padding html 0 0 body 8 0 div 0 0 h1 21 0 h2 19 0 19 0 ...