結果

問題 No.769 UNOシミュレータ
ユーザー PachicobuePachicobue
提出日時 2018-12-16 22:53:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 980 bytes
コンパイル時間 982 ms
コンパイル使用メモリ 76,032 KB
実行使用メモリ 13,056 KB
最終ジャッジ日時 2024-05-02 00:09:34
合計ジャッジ時間 2,336 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 2 ms
5,376 KB
testcase_06 WA -
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 5 ms
5,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 32 ms
6,528 KB
testcase_13 WA -
testcase_14 AC 32 ms
6,400 KB
testcase_15 AC 61 ms
9,600 KB
testcase_16 AC 61 ms
9,808 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 90 ms
12,952 KB
testcase_21 AC 90 ms
12,980 KB
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
int main()
{
    int N, M;
    std::cin >> N >> M;
    std::vector<std::string> l(M);
    for (int i = 0; i < M; i++) { std::cin >> l[i]; }
    std::vector<int> pay(N, 0);
    int p = 0, t = 0, rot = 1;
    for (; t < M;) {
        if (l[t] == "number") {
            pay[p]++, t++;
        } else if (l[t] == "drawtwo") {
            int cost = 0;
            for (; t < M and l[t] == "drawtwo"; t++, cost += 2, (p += rot) %= N) { pay[p]++; }
            pay[p] -= cost;
        } else if (l[t] == "drawfour") {
            int cost = 0;
            for (; t < M and l[t] == "drawfour"; t++, cost += 4, (p += rot) %= N) { pay[p]++; }
            pay[p] -= cost;
        } else if (l[t] == "skip") {
            pay[p]++, t++, (p += rot) %= N;
        } else {
            pay[p]++, t++, rot = (N - rot);
        }
        (p += rot) %= N;
    }
    (p += N - rot) %= N;
    std::cout << p + 1 << " " << pay[p] << std::endl;

    return 0;
}
0