結果

問題 No.73 helloworld
ユーザー sahiyasahiya
提出日時 2020-12-13 20:09:19
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,612 bytes
コンパイル時間 1,711 ms
コンパイル使用メモリ 113,648 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 04:07:16
合計ジャッジ時間 2,814 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <forward_list>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef bitset<16> BS;

const ll MOD = 1E+09 + 7;
const ll INF = 1E18;
const int MAX_N = 1E+05;

int C[26];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    for (int i = 0; i < 26; i++) {
        cin >> C[i];
    }
    ll H = C['h' - 'a'], E = C['e' - 'a'], L = C['l' - 'a'],
       O = C['o' - 'a'], W = C['w' - 'a'], R = C['r' - 'a'], D = C['d' - 'a'];

    ll ans = 0;
    if (!(H < 1 || E < 1 || L < 3 || O < 2 || W < 1 || R < 1 || D < 1)) {
        ll res = H * E * W * R * D;
        //cout << "res = " << res << "\n";
        for (int i = 2; i <= L - 1; i++) {
            for (int j = 1; j <= O - 1; j++) {
                //cout << "i = " << i << ", j = " << j << ", res = " << res * (i * (i - 1)) / 2 * (L - i) * j * (O - j) << "\n";
                ans = max(ans, res * (i * (i - 1)) / 2 * (L - i) * j * (O - j));
            }
        }
    }

    /*
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cout << "i = " << i << ", j = " << j << ", dp = " << dp[i][j] << "\n";
        }
    }
    */

    cout << ans << "\n";

    return 0;
}
0