Contest Duration: ~ (local time) (100 minutes) Back to Home

Submission #7444048

Source Code Expand

Copy
```#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
∧＿∧
∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
（ ´_ゝ`）　/　 ⌒i     @hamayanhamayan
／　　　＼　 　  |　|
/　　 /￣￣￣￣/　　|
＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/

int N, S[2 << 18];
int M;
//---------------------------------------------------------------------------------------------------
#define yes "Yes"
#define no "No"
string solve() {
map<int, int> cnt;
rep(i, 0, M) cnt[S[i]]++;
vector<pair<int,int>> v;
fore(p, cnt) v.push_back(p);
sort(all(v), greater<pair<int, int>>());

priority_queue<int> connection;
connection.push(M);
fore(p, v)
{
int cnt = p.second;
if(connection.size() < cnt)
return no;

vector<int> buf;
rep(i, 0, cnt) {
buf.push_back(connection.top());
connection.pop();
}

fore(c, buf) {
c /= 2;
while (0 < c)
{
connection.push(c);
c /= 2;
}
}
}

return yes;
}
//---------------------------------------------------------------------------------------------------
void _main() {
cin >> N;
int M = 1;
rep(i, 0, N) M *= 2;
rep(i, 0, M) cin >> S[i];

cout << solve() << endl;
}

```

#### Submission Info

Submission Time 2019-09-10 10:04:58+0900 F - Many Slimes hamayanhamayan C++14 (GCC 5.4.1) 0 2300 Byte WA 29 ms 1280 KB

#### Judge Result

Set Name All Sample
Score / Max Score 0 / 600 0 / 0
Status
 AC × 46 WA × 33
 AC × 2 WA × 2
Set Name Test Cases
All sample_01, sample_02, sample_03, sample_04, testcase_0, testcase_1, testcase_10, testcase_11, testcase_12, testcase_13, testcase_14, testcase_15, testcase_16, testcase_17, testcase_18, testcase_19, testcase_2, testcase_20, testcase_21, testcase_22, testcase_23, testcase_24, testcase_25, testcase_26, testcase_27, testcase_28, testcase_29, testcase_3, testcase_30, testcase_31, testcase_32, testcase_33, testcase_34, testcase_35, testcase_36, testcase_37, testcase_38, testcase_39, testcase_4, testcase_40, testcase_41, testcase_42, testcase_43, testcase_44, testcase_45, testcase_46, testcase_47, testcase_48, testcase_49, testcase_5, testcase_50, testcase_51, testcase_52, testcase_53, testcase_54, testcase_55, testcase_56, testcase_57, testcase_58, testcase_59, testcase_6, testcase_60, testcase_61, testcase_62, testcase_63, testcase_64, testcase_65, testcase_66, testcase_67, testcase_68, testcase_69, testcase_7, testcase_70, testcase_71, testcase_72, testcase_73, testcase_74, testcase_8, testcase_9
Sample sample_01, sample_02, sample_03, sample_04
Case Name Status Exec Time Memory
sample_01 1 ms 256 KB
sample_02 1 ms 256 KB
sample_03 1 ms 256 KB
sample_04 1 ms 256 KB
testcase_0 1 ms 256 KB
testcase_1 1 ms 256 KB
testcase_10 27 ms 1280 KB
testcase_11 1 ms 256 KB
testcase_12 1 ms 256 KB
testcase_13 1 ms 256 KB
testcase_14 14 ms 768 KB
testcase_15 1 ms 256 KB
testcase_16 1 ms 256 KB
testcase_17 27 ms 1280 KB
testcase_18 1 ms 256 KB
testcase_19 1 ms 256 KB
testcase_2 13 ms 768 KB
testcase_20 8 ms 512 KB
testcase_21 27 ms 1280 KB
testcase_22 2 ms 256 KB
testcase_23 27 ms 1280 KB
testcase_24 8 ms 512 KB
testcase_25 1 ms 256 KB
testcase_26 2 ms 256 KB
testcase_27 1 ms 256 KB
testcase_28 1 ms 256 KB
testcase_29 1 ms 256 KB
testcase_3 14 ms 768 KB
testcase_30 1 ms 256 KB
testcase_31 27 ms 1280 KB
testcase_32 27 ms 1280 KB
testcase_33 27 ms 1280 KB
testcase_34 27 ms 1280 KB
testcase_35 27 ms 1280 KB
testcase_36 4 ms 384 KB
testcase_37 1 ms 256 KB
testcase_38 1 ms 256 KB
testcase_39 1 ms 256 KB
testcase_4 25 ms 1280 KB
testcase_40 4 ms 384 KB
testcase_41 8 ms 512 KB
testcase_42 1 ms 256 KB
testcase_43 27 ms 1280 KB
testcase_44 1 ms 256 KB
testcase_45 3 ms 384 KB
testcase_46 27 ms 1280 KB
testcase_47 1 ms 256 KB
testcase_48 1 ms 256 KB
testcase_49 1 ms 256 KB
testcase_5 25 ms 1280 KB
testcase_50 4 ms 384 KB
testcase_51 1 ms 256 KB
testcase_52 1 ms 256 KB
testcase_53 1 ms 256 KB
testcase_54 3 ms 384 KB
testcase_55 1 ms 256 KB
testcase_56 1 ms 256 KB
testcase_57 2 ms 256 KB
testcase_58 1 ms 256 KB
testcase_59 27 ms 1280 KB
testcase_6 27 ms 1280 KB
testcase_60 1 ms 256 KB
testcase_61 1 ms 256 KB
testcase_62 1 ms 256 KB
testcase_63 1 ms 256 KB
testcase_64 1 ms 256 KB
testcase_65 1 ms 256 KB
testcase_66 1 ms 256 KB
testcase_67 1 ms 256 KB
testcase_68 1 ms 256 KB
testcase_69 1 ms 256 KB
testcase_7 27 ms 1280 KB
testcase_70 1 ms 256 KB
testcase_71 1 ms 256 KB
testcase_72 1 ms 256 KB
testcase_73 1 ms 256 KB
testcase_74 1 ms 256 KB
testcase_8 27 ms 1280 KB
testcase_9 29 ms 1280 KB