結果

問題 No.268 ラッピング(Easy)
ユーザー Kmcode1Kmcode1
提出日時 2015-08-21 22:34:35
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,542 bytes
コンパイル時間 820 ms
コンパイル使用メモリ 94,192 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-25 14:54:55
合計ジャッジ時間 1,517 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0