結果

問題 No.662 スロットマシーン
ユーザー tactac
提出日時 2019-07-25 23:11:13
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,682 bytes
コンパイル時間 2,204 ms
コンパイル使用メモリ 182,140 KB
実行使用メモリ 8,752 KB
最終ジャッジ日時 2023-09-15 00:09:49
合計ジャッジ時間 7,413 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep3(i, l, n) for (int i = l; i < n; ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define out(a) cout << a << endl
#define outa(a, n) rep(_, n) cout << a[_] << " "; cout << endl
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)

int main() {
    map<string, int> mp;
    int coin[5];
    rep(i, 5) { string str; cin >> str; mp[str] = i; cin >> coin[i]; }
    int n[3];
    vector<string> can[3];
    rep(i, 3) {
        cin >> n[i];
        rep(j, n[i]) { string str; cin >> str; can[i].eb(str); }
    }
    int acc[5] = {0};
    rep(i, n[0]) rep(j, n[1]) rep(k, n[2]) {
        string c00 = can[0][i];
        string c01 = can[0][(i + 1) % n[0]];
        string c02 = can[0][(i + 2) % n[0]];
        string c10 = can[1][j];
        string c11 = can[1][(j + 1) % n[1]];
        string c12 = can[1][(j + 2) % n[1]];
        string c20 = can[2][k];
        string c21 = can[2][(k + 1) % n[2]];
        string c22 = can[2][(k + 2) % n[2]];
        
        if (c00 == c10 && c10 == c20) acc[mp[c00]]++;
        if (c01 == c11 && c11 == c21) acc[mp[c01]]++;
        if (c02 == c12 && c12 == c22) acc[mp[c02]]++;
        if (c00 == c11 && c11 == c22) acc[mp[c00]]++;
        if (c02 == c11 && c11 == c20) acc[mp[c02]]++;
    }
    int tmp = 0;
    rep(i, 5) {
        tmp += acc[i] * coin[i];
    }
    out(fixed << setprecision(7) << (double)tmp / (n[0] * n[1] * n[2]));
    rep(i, 5) {
        out(acc[i]);
    }
}
0