結果
問題 | No.472 平均順位 |
ユーザー |
|
提出日時 | 2020-06-10 10:15:55 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,156 ms / 2,000 ms |
コード長 | 529 bytes |
コンパイル時間 | 2,213 ms |
コンパイル使用メモリ | 192,524 KB |
最終ジャッジ日時 | 2025-01-11 00:45:27 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:10:23: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | int n,m; scanf("%d%d",&n,&m); | ~~~~~^~~~~~~~~~~~~~ main.cpp:16:31: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 16 | rep(k,3) scanf("%d",&a[k]); | ~~~~~^~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>#define rep(i,n) for(int i=0;i<(n);i++)using namespace std;const int INF=1<<29;int main(){int n,m; scanf("%d%d",&n,&m);int dp[2][15001];rep(j,m+1) dp[0][j]=(j==m?0:INF);rep(i,n){int a[4];rep(k,3) scanf("%d",&a[k]);a[3]=1;int curr=i%2,next=(i+1)%2;rep(j,m+1) dp[next][j]=INF;rep(j,m+1) rep(k,4) if(j>=k) dp[next][j-k]=min(dp[next][j-k],dp[curr][j]+a[k]);rep(j,m+1) dp[curr][j]=dp[next][j];}printf("%.9f\n",1.0**min_element(dp[n%2],dp[n%2]+m+1)/n);return 0;}