Submission #1990513
Source Code Expand
#include <bits/stdc++.h> using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define rep(i,n) FOR(i,0,n) #define pb emplace_back #define mp make_pair typedef long long ll; typedef pair<int,int> pint; map<int,int> t; vector<int> cnt,v; int main(){ int n,ai; cin>>n; rep(i,n){ cin>>ai; ++t[ai]; } bool flag=true; if(t.size()>2){ flag=false; } else{ for(auto it:t){ v.pb(it.first); cnt.pb(it.second); } if(v.size()==1){ if(v[0]!=n-1&&v[0]*2>n) flag=false; } else{ if(v[1]<=cnt[0]||(v[1]-cnt[0])*2>cnt[1]) flag=false; } } if(flag) cout<<"YES"<<endl; else cout<<"NO"<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Colorful Hats |
User | ts_ |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 801 Byte |
Status | WA |
Exec Time | 60 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 | WA | 1 ms | 256 KB |
0_02.txt | WA | 1 ms | 256 KB |
0_03.txt | WA | 1 ms | 256 KB |
0_04.txt | WA | 1 ms | 256 KB |
0_05.txt | WA | 1 ms | 256 KB |
1_00.txt | WA | 1 ms | 256 KB |
1_01.txt | WA | 1 ms | 256 KB |
1_02.txt | WA | 19 ms | 256 KB |
1_03.txt | WA | 36 ms | 256 KB |
1_04.txt | WA | 36 ms | 256 KB |
1_05.txt | WA | 38 ms | 256 KB |
1_06.txt | WA | 36 ms | 256 KB |
1_07.txt | WA | 38 ms | 256 KB |
1_08.txt | WA | 19 ms | 256 KB |
1_09.txt | WA | 36 ms | 256 KB |
1_10.txt | WA | 21 ms | 256 KB |
1_11.txt | WA | 37 ms | 256 KB |
1_12.txt | WA | 36 ms | 256 KB |
1_13.txt | WA | 37 ms | 256 KB |
1_14.txt | WA | 38 ms | 256 KB |
1_15.txt | WA | 1 ms | 256 KB |
1_16.txt | WA | 1 ms | 256 KB |
1_17.txt | WA | 60 ms | 4992 KB |