結果
| 問題 |
No.27 板の準備
|
| コンテスト | |
| ユーザー |
momoyuu
|
| 提出日時 | 2024-07-28 00:46:01 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 914 bytes |
| コンパイル時間 | 1,115 ms |
| コンパイル使用メモリ | 96,084 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-28 00:46:04 |
| 合計ジャッジ時間 | 2,739 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 WA * 1 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
vector<int> use(4);
for(int i = 0;i<4;i++) cin>>use[i];
int mx = 0;
int ans = 1e8;
for(int i = 0;i<4;i++) mx = max(mx,use[i]);
for(int i = 1;i<=mx;i++){
for(int j = i + 1;j<=mx;j++){
for(int k = j + 1;k<=mx;k++){
vector<int> dp(mx+1,1e8);
dp[0] = 0;
for(int l = 1;l<=mx;l++){
if(l-i>=0) dp[l] = min(dp[l],dp[l-i]+1);
if(l-j>=0) dp[l] = min(dp[l],dp[l-j]+1);
if(l-k>=0) dp[l] = min(dp[l],dp[l-k]+1);
}
int cnt = 0;
for(int l = 0;l<4;l++) cnt += dp[use[l]];
ans = min(ans,cnt);
}
}
}
cout<<ans<<endl;
}
momoyuu