結果
問題 |
No.412 花火大会
|
ユーザー |
![]() |
提出日時 | 2016-09-19 22:10:06 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,158 bytes |
コンパイル時間 | 806 ms |
コンパイル使用メモリ | 95,048 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-17 09:58:01 |
合計ジャッジ時間 | 1,453 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 18 |
ソースコード
#include <cstdio> #include <cstring> #include <string> #include <cmath> #include <cassert> #include <iostream> #include <algorithm> #include <stack> #include <queue> #include <vector> #include <set> #include <map> #include <bitset> using namespace std; #define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define rep(i,n) repl(i,0,n) #define mp(a,b) make_pair(a,b) #define pb(a) push_back(a) #define all(x) (x).begin(),(x).end() #define dbg(x) cout<<#x"="<<x<<endl #define fi first #define se second #define INF 2147483600 long comb(long n, long r){ if(r>n-r) r=n-r; long p=1; for (long i=1; i<=r; i++) p=p*(n-i+1)/i; return p; } int main(){ vector<int> sz(3); while(cin>>sz[0]>>sz[1]>>sz[2]){ sort(all(sz)); int n; cin>>n; vector<int> vec(n), cnt(4,0); rep(i,n){ int d; scanf("%d", &d); cnt[ (d>=sz[0]) + (d>=sz[1]) + (d>=sz[2]) ]++; } long res=0; rep(a,cnt[0]+1) rep(b,cnt[1]+1) rep(c, cnt[2]+1) rep(d, cnt[3]+1){ if(d<1 || c+d<2 || b+c+d<3) continue; res += comb(cnt[0],a) * comb(cnt[1],b) * comb(cnt[2],c) * comb(cnt[3],d); } cout<<res<<endl; } return 0; }