結果

問題 No.662 スロットマシーン
ユーザー phsplsphspls
提出日時 2020-04-16 23:26:19
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 1,265 bytes
コンパイル時間 2,454 ms
コンパイル使用メモリ 179,632 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-14 06:30:16
合計ジャッジ時間 3,189 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (llong i = 0; i < (llong)(n); i++)
#define llong long long

int main() {
    map<string, llong> icon2val;
    vector<string> icons(5);
    rep(i, 5) {
        string icon;
        llong val;
        cin >> icon >> val;
        icons[i] = icon;
        icon2val[icon] = val;
    }
    llong n1;
    cin >> n1;
    map<string, llong> roll1;
    rep(i, 5) roll1[icons[i]] = 0;
    rep(i, n1) {
        string icon;
        cin >> icon;
        roll1[icon] += 1;
    }
    llong n2;
    cin >> n2;
    map<string, llong> roll2;
    rep(i, 5) roll2[icons[i]] = 0;
    rep(i, n2) {
        string icon;
        cin >> icon;
        roll2[icon] += 1;
    }
    llong n3;
    cin >> n3;
    map<string, llong> roll3;
    rep(i, 5) roll3[icons[i]] = 0;
    rep(i, n3) {
        string icon;
        cin >> icon;
        roll3[icon] += 1;
    }

    double summary = 0.0;
    vector<llong> matchedval(5, 0);
    rep(i, 5) {
        string icon = icons[i];
        llong val = icon2val[icon];
        matchedval[i] = 5LL * roll1[icon] * roll2[icon] * roll3[icon];
        summary += (double)matchedval[i] / (n1*n2*n3) * val;
    }
    printf("%.3f\n", summary);
    rep(i, 5) cout << matchedval[i] << endl;
}
0