Submission #1791938
Source Code Expand
#include <bits/stdc++.h> #define int long long using namespace std; int a[100001]; main () { ios_base::sync_with_stdio (0); cin.tie (0); int n; cin >> n; int mn = 1e9 + 7; int mx = 0; int kl = 0, kr = 0; for (int i = 1;i <= n;i ++) { cin >> a[i]; mn = min (mn, a[i]); mx = max (mx, a[i]); } for (int i = 1;i <= n;i ++) { if (a[i] == mn) kl ++; if (a[i] == mx) kr ++; } if (mn == mx) { if (mn == n - 1) { cout << "Yes"; return 0; } if (mn + mn <= n) { cout << "Yes"; return 0; } cout << "No"; return 0; } int A = mx; if (A >= kl + 1 && 2 * kr + kl <= A) { cout << "Yes"; } else cout << "No"; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Colorful Hats |
User | almasalmas |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 715 Byte |
Status | WA |
Exec Time | 9 ms |
Memory | 1024 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 | 7 ms | 1024 KB |
1_03.txt | AC | 9 ms | 1024 KB |
1_04.txt | AC | 9 ms | 1024 KB |
1_05.txt | AC | 9 ms | 1024 KB |
1_06.txt | AC | 9 ms | 1024 KB |
1_07.txt | AC | 9 ms | 1024 KB |
1_08.txt | AC | 7 ms | 1024 KB |
1_09.txt | AC | 9 ms | 1024 KB |
1_10.txt | AC | 7 ms | 1024 KB |
1_11.txt | WA | 9 ms | 1024 KB |
1_12.txt | AC | 9 ms | 1024 KB |
1_13.txt | WA | 9 ms | 1024 KB |
1_14.txt | AC | 9 ms | 1024 KB |
1_15.txt | AC | 1 ms | 256 KB |
1_16.txt | AC | 1 ms | 256 KB |
1_17.txt | WA | 9 ms | 1024 KB |