結果
問題 | No.268 ラッピング(Easy) |
ユーザー |
![]() |
提出日時 | 2015-08-21 22:34:35 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 1,542 bytes |
コンパイル時間 | 762 ms |
コンパイル使用メモリ | 95,000 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-18 11:44:00 |
合計ジャッジ時間 | 1,216 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
#include<iostream>#include<cstdio>#include<cstring>#include<string>#include<cctype>#include<cstdlib>#include<algorithm>#include<bitset>#include<vector>#include<list>#include<deque>#include<queue>#include<map>#include<set>#include<stack>#include<cmath>#include<sstream>#include<fstream>#include<iomanip>#include<ctime>#include<complex>#include<functional>#include<climits>#include<cassert>#include<iterator>using namespace std;int a, b, c;int A, B, C;int main(){cin >> a >> b >> c;cin >> A >> B >> C;int aa[] = { a, b, c };int ww[] = { A, B, C };vector<pair<int, int> > v;for (int i = 0; i < 3; i++){for (int j = i+1; j < 3; j++){v.push_back(make_pair(i, j));}}int outt = INT_MAX;for (int i = 0; i < v.size(); i++){for (int j = 0; j < v.size(); j++){for (int k = 0; k < v.size(); k++){int countt[] = { 0, 0, 0 };countt[v[i].first]++;countt[v[i].second]++;countt[v[j].first]++;countt[v[j].second]++;countt[v[k].first]++;countt[v[k].second]++;bool ok = false;for (int ii = 0; ii < 3; ii++){if (countt[ii] != 2){ok = true;break;}}if (ok){continue;}int ans = 0;vector<pair<int,int> > V;V.push_back(v[i]);V.push_back(v[j]);V.push_back(v[k]);for (int kk = 0; kk < V.size(); kk++){int aaa = aa[V[kk].first] + aa[V[kk].second];aaa *= 2;aaa *= ww[kk];ans += aaa;}outt = min(outt, ans);}}}printf("%d\n", outt);return 0;}