Submission #2170922
Source Code Expand
#include<bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<LL,LL> P; const LL mod=1e9+7; const LL LINF=1LL<<62; const int INF=1<<17; int main(){ int N; cin >> N; int maxi=0,mini=INF; map<int,int> mp; for(int i=0;i<N;i++){ int x; cin >> x; mp[x]++; maxi=max(maxi,x); mini=min(mini,x); } if(maxi-mini>1) puts("No"); else if(maxi-mini==1){ if(mp[mini]>=mini) puts("No"); else if(mini-mp[mini]<mp[maxi]/2) puts("Yes"); else puts("No"); } else{ if(maxi==N-1) puts("Yes"); else if(1<=maxi&&maxi<=N/2) puts("Yes"); else puts("No"); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Colorful Hats |
User | Yukly |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 730 Byte |
Status | WA |
Exec Time | 50 ms |
Memory | 4992 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 700 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 0_04.txt, 0_05.txt |
All | 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 0_04.txt, 0_05.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt, 1_15.txt, 1_16.txt, 1_17.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_00.txt | WA | 1 ms | 256 KB |
0_01.txt | AC | 1 ms | 256 KB |
0_02.txt | AC | 1 ms | 256 KB |
0_03.txt | AC | 1 ms | 256 KB |
0_04.txt | AC | 1 ms | 256 KB |
0_05.txt | AC | 1 ms | 256 KB |
1_00.txt | AC | 1 ms | 256 KB |
1_01.txt | AC | 1 ms | 256 KB |
1_02.txt | AC | 17 ms | 256 KB |
1_03.txt | AC | 30 ms | 256 KB |
1_04.txt | AC | 30 ms | 256 KB |
1_05.txt | AC | 30 ms | 256 KB |
1_06.txt | AC | 30 ms | 256 KB |
1_07.txt | AC | 30 ms | 256 KB |
1_08.txt | AC | 17 ms | 256 KB |
1_09.txt | AC | 30 ms | 256 KB |
1_10.txt | AC | 17 ms | 256 KB |
1_11.txt | WA | 30 ms | 256 KB |
1_12.txt | AC | 30 ms | 256 KB |
1_13.txt | AC | 31 ms | 256 KB |
1_14.txt | AC | 31 ms | 256 KB |
1_15.txt | AC | 1 ms | 256 KB |
1_16.txt | AC | 1 ms | 256 KB |
1_17.txt | AC | 50 ms | 4992 KB |