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. 维护没有源代码,float改成double

    float f= 931340.31f; Console.WriteLine(f.ToString("#,###,##0.00")); 返回 931,340.30 ,float 1 ...

  2. laravel named route

    laravel中一般对于路由的使用方法是在routes.php中定义一个路由,在view中如果要引用一个url则直接通过<a href="url/">来使用. 但是随着 ...

  3. laravel重要概念和知识点

    Service Provider: 一个laravel service provider就是一个注册IoC container binding的类.实际上,laravel本身就自包含了一堆管理核心框架 ...

  4. UVa 340 Master-Mind Hints

    蛋疼的题目描述,看了好长好长时间才看懂,题目本身是很简单的. Designer给出一串长度为N的Code,Breaker用Guess来破译. 对于两串数字,如果有同一列相等的数字,那么叫做strong ...

  5. 模拟实现STL中的list

    #pragma once #include<iostream>using namespace std;#include<assert.h> template<class ...

  6. BZOJ 1003 物流运输

    最短路+dp. #include<iostream> #include<cstdio> #include<cstring> #include<algorith ...

  7. php的类型约束

    //如下面的类 class MyClass { /** * 测试函数 * 第一个参数必须为 OtherClass 类的一个对象 */ public function test(OtherClass $ ...

  8. 三 最简单的 AndEngine 程序框架

    package com.example.AndEngineExample; import org.anddev.andengine.engine.Engine;import org.anddev.an ...

  9. 学好Javascript是有方法的

    先声明下噢,这篇文章不是自个儿写的,看着好,希望前端小孩们可以和我一起加油,大家都来借鉴借鉴吧- 首先要说明的是,咱现在不是高手,最多还是一个半桶水,算是入了JS的门. 谈不上经验,都是一些教训. 这 ...

  10. MVC中如何跳过对模型中某个属性的验证

    [HttpPost] public ActionResult Create(Users user) { ModelState.Remove(“Password”); //加上这句就行了 if (Mod ...