結果
問題 | No.412 花火大会 |
ユーザー |
|
提出日時 | 2016-09-29 22:41:24 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,253 bytes |
コンパイル時間 | 889 ms |
コンパイル使用メモリ | 86,756 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-21 10:42:07 |
合計ジャッジ時間 | 1,643 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 14 WA * 4 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <array> #include <set> #include <map> #include <queue> #include <tuple> #include <unordered_set> #include <unordered_map> #include <functional> #include <cassert> #define repeat(i,n) for (int i = 0; (i) < (n); ++(i)) typedef long long ll; using namespace std; ll p(int n) { return 1ll << n; } ll c(int n, int r) { ll acc = 1; repeat (i,r) acc *= n-i; repeat (i,r) acc /= i+1; return acc; } ll f(int n, int r) { ll acc = p(n); repeat (i,r) acc -= c(n,i); return acc; } int main() { // input int b, c, d; cin >> b >> c >> d; int n; cin >> n; vector<int> es(n); repeat (i,n) cin >> es[i]; // compute array<int,4> e = {}; repeat (i,n) { int cnt = 0; cnt += int(b <= es[i]); cnt += int(c <= es[i]); cnt += int(d <= es[i]); e[cnt] += 1; } ll ans = 0; ans += p(e[0]) * f(e[1], 1) * f(e[2], 1) * f(e[3], 1); ans += p(e[0]) * f(e[1], 1) * f(e[3], 2); ans += p(e[0]) * f(e[2], 2) * f(e[3], 1); ans += p(e[0]) * f(e[2], 1) * f(e[3], 2); ans += p(e[0]) * f(e[3], 3); cout << ans << endl; return 0; }