提出 #26014537
ソースコード 拡げる
#include "bits/stdc++.h"
using namespace std;
#define int long long
const int64_t INF = 9e18+7;
const int MAXN = 1e6 + 7;
struct stickcombo{
int a,b,c,d;
};
vector <struct stickcombo> ways = {
{2,5,0,0} , {2,1,4,2} , {2,2,3,2} , {2,3,4,1} , {3,2,4,1}
};
vector <int> order = {0,1,2,3,4};
void SolveCase(){
vector <int> A(3);
for(auto &x : A) cin >> x;
int ans = 0;
do{
vector <int> B = A;
int new_ans = 0;
for(int id : order){
auto [a,x,b,y] = ways[id];
auto &b1 = B[a-2] , &b2 = B[b-2];
if(b!=0){
int t = min(b1/x,b2/y);
new_ans += t;
b1 -= x*t;
b2 -= y*t;
}
else{
new_ans += b1/5;
b1 %= 5;
}
}
ans = max(ans,new_ans);
}while(next_permutation(order.begin(),order.end()));
cout << ans << "\n";
}
int32_t main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int testcases = 1;
cin >> testcases;
for(int tc=1;tc<=testcases;tc++){
// cout << "Case #" << tc << ":\n";
SolveCase();
}
}
提出情報
| 提出日時 |
|
| 問題 |
A - Make 10 |
| ユーザ |
LetsDoSmtgDiff |
| 言語 |
C++ (GCC 9.2.1) |
| 得点 |
300 |
| コード長 |
1101 Byte |
| 結果 |
AC |
| 実行時間 |
8 ms |
| メモリ |
3632 KiB |
ジャッジ結果
| セット名 |
Sample |
All |
| 得点 / 配点 |
0 / 0 |
300 / 300 |
| 結果 |
|
|
| セット名 |
テストケース |
| Sample |
01_sample_01.txt |
| All |
01_sample_01.txt, 02_mix_01.txt, 02_mix_02.txt, 02_mix_03.txt, 02_mix_04.txt, 02_mix_05.txt |
| ケース名 |
結果 |
実行時間 |
メモリ |
| 01_sample_01.txt |
AC |
6 ms |
3580 KiB |
| 02_mix_01.txt |
AC |
3 ms |
3412 KiB |
| 02_mix_02.txt |
AC |
4 ms |
3592 KiB |
| 02_mix_03.txt |
AC |
4 ms |
3476 KiB |
| 02_mix_04.txt |
AC |
8 ms |
3412 KiB |
| 02_mix_05.txt |
AC |
5 ms |
3632 KiB |