记录编号 |
122080 |
评测结果 |
AAAAAAAAAA |
题目名称 |
[USACO Jan08] 奶牛的选举 |
最终得分 |
100 |
用户昵称 |
HouJikan |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.053 s |
提交时间 |
2014-09-22 16:25:55 |
内存使用 |
0.62 MiB |
显示代码纯文本
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <set>
#include <list>
#include <iterator>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <functional>
#include <deque>
#define For(i,j,k) for(int i=(j);i<=(k);i++)
using namespace std;
typedef long long LL;
typedef unsigned int Uint;
const int INF=0x7ffffff;
using namespace std;
//================struct declaration======================
//================var declaration=-========================
const int MAXN=50010;
int rank[MAXN],n,k;
int A[MAXN],B[MAXN];
//================function declaration====================
bool cmp1(int a,int b){return A[a]>A[b];}
bool cmp2(int a,int b){return B[a]>B[b];}
//================main code===============================
int main()
{
string ProgrammeName="elect";
string FloderName="COGS";
freopen((ProgrammeName+".in").c_str(),"r",stdin);
freopen((ProgrammeName+".out").c_str(),"w",stdout);
#ifdef DEBUG
clock_t Start_Time=clock();
system(("copy C:\\Users\\abc\\Desktop\\HouJikan\\"+FloderName+"\\standard.cpp C:\\Users\\abc\\Desktop\\HouJikan\\"+FloderName+"\\submit.txt").c_str());
#endif
scanf("%d%d",&n,&k);
For(i,1,n)
scanf("%d%d",A+i,B+i),rank[i]=i;
sort(rank+1,rank+1+n,cmp1);
sort(rank+1,rank+1+k,cmp2);
printf("%d\n",rank[1]);
#ifdef DEBUG
clock_t End_Time=clock();
printf("\n\nTime Used :%.6lf Ms\n",double(Start_Time-End_Time)/(-CLOCKS_PER_SEC));
#endif
return 0;
}
//================function code===========================