結果

問題 No.769 UNOシミュレータ
ユーザー aaaaaaiu
提出日時 2019-08-01 12:01:24
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 886 bytes
コンパイル時間 2,205 ms
コンパイル使用メモリ 193,836 KB
最終ジャッジ日時 2025-01-07 10:25:56
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    int n,m;
    cin>>n>>m;
    int cnt[n] {};
    int turn = 0;
    int dir = 1;
    bool draw = false;
    for (int i = 0; i < m; i++) {
        string s;
        cin >> s;
        if (draw) {
            if (s == "drawtwo" || s == "drawfour") {
                cnt[turn]++;
                turn = (turn + dir + n) % n;
                continue;
            } else {
                turn = (turn + dir + n) % n;
                draw = false;
            }
        }
        cnt[turn]++;
        if (s == "drawtwo" || s == "drawfour") draw = true;
        else if (s == "reverse") dir = -dir;
        else if (s == "skip") turn = (turn + dir + n) % n;
        turn = (turn + dir + n) % n;
    }
    int winner = (turn - dir + n) % n;
    cout << winner + 1 << ' ' << cnt[winner] << endl;
    return 0;
}
0