比赛 |
noip2016普及练习2 |
评测结果 |
AAAAAAAAAA |
题目名称 |
谁是卧底 |
最终得分 |
100 |
用户昵称 |
Bravo ChaoS |
运行时间 |
0.022 s |
代码语言 |
C++ |
内存使用 |
0.35 MiB |
提交时间 |
2016-11-07 20:05:17 |
显示代码纯文本
- #include<cstdio>
- #include<cstring>
- #include<algorithm>
- #include<iostream>
- #include<map>
- using namespace std;
-
- const int maxn=10010;
-
- class input
- {
- public:
- input& operator >> (int& x)
- {
- char c=' ';x=0;
- while(c<'0' || c>'9') c=getchar();
- while(c>='0' && c<='9') x=x*10+c-'0',c=getchar();
- return *this;
- }
- }in;
-
- map<int,int> mp;
- int a[maxn],cur=0,n,m;
-
- int main()
- {
- freopen("leader.in","r",stdin);
- freopen("leader.out","w",stdout);
- in>>m>>n;
- for(int i=0,t;i<n;++i) {in>>t;if(!mp[t]) a[++cur]=t;mp[t]++;}
- n>>=1;
- for(int i=1;i<=cur;++i) if(mp[a[i]]>n)
- {
- cout<<a[i]<<endl;
- return 0;
- }
- printf("-1\n");
- return 0;
- }
-