結果
問題 | No.268 ラッピング(Easy) |
ユーザー |
![]() |
提出日時 | 2015-09-08 20:31:20 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 457 bytes |
コンパイル時間 | 1,374 ms |
コンパイル使用メモリ | 160,352 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-19 05:00:30 |
合計ジャッジ時間 | 1,811 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main() {array<int, 3> l, a;for (int& i : l) cin >> i;for (int& i : a) cin >> i;sort(l.begin(), l.end());int res = numeric_limits<int>::max();int sum = 2 * accumulate(l.begin(), l.end(), 0) * accumulate(a.begin(), a.end(), 0);do {res = min(res, sum - 2 * inner_product(l.begin(), l.end(), a.begin(), 0));} while (next_permutation(l.begin(), l.end()));cout << res << endl;}