結果

問題 No.769 UNOシミュレータ
ユーザー PachicobuePachicobue
提出日時 2018-12-16 23:08:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,328 bytes
コンパイル時間 685 ms
コンパイル使用メモリ 78,160 KB
実行使用メモリ 13,052 KB
最終ジャッジ日時 2024-05-02 00:09:44
合計ジャッジ時間 3,733 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 3 ms
5,376 KB
testcase_03 AC 3 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 3 ms
5,376 KB
testcase_06 AC 3 ms
5,376 KB
testcase_07 WA -
testcase_08 AC 4 ms
5,376 KB
testcase_09 WA -
testcase_10 AC 10 ms
5,376 KB
testcase_11 AC 10 ms
5,376 KB
testcase_12 WA -
testcase_13 AC 54 ms
6,400 KB
testcase_14 WA -
testcase_15 AC 179 ms
9,708 KB
testcase_16 AC 182 ms
9,600 KB
testcase_17 AC 180 ms
9,704 KB
testcase_18 AC 322 ms
12,944 KB
testcase_19 AC 336 ms
12,968 KB
testcase_20 AC 333 ms
13,052 KB
testcase_21 AC 321 ms
12,928 KB
testcase_22 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#define show(x) std::cerr << #x << " = " << (x) << std::endl
template <typename T, typename A>
std::ostream& operator<<(std::ostream& os, const std::vector<T, A>& v)
{
    os << "[";
    for (const auto& p : v) { os << p << ","; }
    return (os << "]\n");
}
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; (p += rot) %= N) {
        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);
        }
    }
    show(pay);
    p = (l.back().front() == 'd' or l.back().front() == 's' ? (p + 2 * N - 2 * rot) % N : (p + N - 1) % N);
    std::cout << p + 1 << " " << pay[p] << std::endl;

    return 0;
}
0