update
This commit is contained in:
		
							parent
							
								
									6bc2d99e25
								
							
						
					
					
						commit
						39c9114206
					
				| @ -1,10 +1,48 @@ | ||||
| #include<bits/stdc++.h> | ||||
| using namespace std; | ||||
| typedef long long ll; | ||||
| 
 | ||||
| #ifdef OI | ||||
| #define PV(v){cout<<#v<<" : "<<(v)<<endl;} | ||||
| #else | ||||
| #define PV(v) | ||||
| #endif | ||||
| 
 | ||||
| int n; | ||||
| map<ll,int> m; | ||||
| ll readint(); | ||||
| 
 | ||||
| int main(){ | ||||
|     ios::sync_with_stdio(false),cin.tie(0),cout.tie(0); | ||||
|     n=readint(); | ||||
|     for(int i=1;i<=n;i++){ | ||||
|         m[readint()]++; | ||||
|     } | ||||
|     int max_m=INT_MIN; | ||||
|     ll max_dir = -1; | ||||
|     for(auto i :m){ | ||||
|         if(max_m<i.second){ | ||||
|             max_m=i.second; | ||||
|             max_dir=i.first; | ||||
|         } | ||||
|     } | ||||
|     if(max_m>n/2){ | ||||
|         cout<<max_dir<<endl; | ||||
|     }else{ | ||||
|         cout<<"No"<<endl; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|      | ||||
| ll readint(){ | ||||
|     int x=0,w=1; | ||||
|     char ch=0; | ||||
|     while(!isdigit(ch)){ | ||||
|         if(ch=='-')w=-1; | ||||
|         ch=getchar(); | ||||
|     } | ||||
|     while(isdigit(ch)){ | ||||
|         x=x*10+(ch-'0'); | ||||
|         ch=getchar(); | ||||
|     } | ||||
|     return x*w; | ||||
| } | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user