Submission #1364595
Source Code Expand
#include <iostream> #include <algorithm> #include <vector> #include <unordered_map> #include <unordered_set> #include <cmath> #include <cstdio> #include <map> #include <set> #include <utility> #include <string> #include <functional> #include <queue> #include <stack> using namespace std; typedef long long ll; typedef long double ld; int main() { ios_base::sync_with_stdio(false); int n; cin >> n; vector<int> arr(n); int i; for(i = 0; i < n; i++) { cin >> arr[i]; } sort(arr.begin(), arr.end()); bool poss = false; if(arr[n - 1] - arr[0] <= 1) { if(arr[0] == arr[n - 1]) { if(arr[0] == n - 1) { poss = true; } else { poss = (n >= 2 * arr[0]); } } else { int c1 = 0, c2 = 0; for(i = 0; i < n; i++) { if(arr[i] == arr[0]) { c1++; } else { c2++; } } //int col_left = arr[n - 1] - c1; poss = (c2 >= 2) && (c1 == arr[0]); } } if(poss) { cout << "Yes"; } else { cout << "No"; } cout << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Colorful Hats |
User | infomaniac |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1070 Byte |
Status | WA |
Exec Time | 11 ms |
Memory | 640 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 | AC | 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 | 9 ms | 640 KB |
1_03.txt | AC | 11 ms | 640 KB |
1_04.txt | AC | 11 ms | 640 KB |
1_05.txt | AC | 11 ms | 640 KB |
1_06.txt | AC | 11 ms | 640 KB |
1_07.txt | AC | 11 ms | 640 KB |
1_08.txt | AC | 9 ms | 640 KB |
1_09.txt | AC | 11 ms | 640 KB |
1_10.txt | AC | 9 ms | 640 KB |
1_11.txt | AC | 11 ms | 640 KB |
1_12.txt | AC | 11 ms | 640 KB |
1_13.txt | WA | 11 ms | 640 KB |
1_14.txt | AC | 11 ms | 640 KB |
1_15.txt | AC | 1 ms | 256 KB |
1_16.txt | AC | 1 ms | 256 KB |
1_17.txt | AC | 11 ms | 640 KB |