結果

問題 No.769 UNOシミュレータ
ユーザー Pachicobue
提出日時 2018-12-16 23:08:48
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,328 bytes
コンパイル時間 867 ms
コンパイル使用メモリ 75,268 KB
最終ジャッジ日時 2025-01-06 19:37:30
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19 WA * 4
権限があれば一括ダウンロードができます

ソースコード

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