結果
問題 |
No.412 花火大会
|
ユーザー |
![]() |
提出日時 | 2024-11-10 20:54:20 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,103 bytes |
コンパイル時間 | 2,081 ms |
コンパイル使用メモリ | 196,260 KB |
最終ジャッジ日時 | 2025-02-25 03:28:44 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 4 |
other | WA * 18 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:34:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 34 | freopen("kettle.in","r",stdin); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ main.cpp:35:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 35 | freopen("kettle.out","w",stdout); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<bits/stdc++.h> using namespace std; int vis[100010],v[100010],t[100010],xb; int n,aa[10],ans,a[100010]; int C[1010][1010]; void check(){ bool fa=false,fb=false,fc=false; for(int i=xb;i>=1;--i){ if(vis[i]){ int x=vis[i]; if(!fc&&x&&v[i]>=aa[3]) fc=true,x--; if(!fb&&x&&v[i]>=aa[2]) fb=true,x--; if(!fa&&x&&v[i]>=aa[1]) fa=true,x--; } } if(!fa||!fb||!fc) return; int ret=1; for(int i=1;i<=xb;++i) ret*=C[t[i]][vis[i]]; ans+=ret; } void dfs(int dep){ if(dep==xb){ check(); } else{ for(int i=0;i<=t[dep+1];++i){ vis[dep+1]=i; dfs(dep+1); } } } int main(){ freopen("kettle.in","r",stdin); freopen("kettle.out","w",stdout); C[0][0]=1; for(int i=1;i<=200;++i) for(int j=0;j<=i;++j){ if(j>0) C[i][j]=C[i-1][j]+C[i-1][j-1]; else C[i][j]=C[i-1][j]; } cin>>aa[1]>>aa[2]>>aa[3]; sort(aa+1,aa+3+1); cin>>n; for(int i=1;i<=n;++i) cin>>a[i]; sort(a+1,a+n+1); for(int i=1;i<=n;++i){ bool f=false; for(int j=1;j<=xb;++j) if(v[j]==a[i]){ t[j]++; f=true; } if(!f){ v[++xb]=a[i]; t[xb]=1; } } dfs(0); cout<<ans<<endl; }