結果

問題 No.769 UNOシミュレータ
ユーザー Bantako
提出日時 2018-12-26 21:07:07
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,222 bytes
コンパイル時間 1,671 ms
コンパイル使用メモリ 168,584 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-22 08:58:11
合計ジャッジ時間 3,392 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17 WA * 6
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main(){
      | ^~~~

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N,M;
    cin >> N >> M;
    vector<int> V(N);
    int turn = 0, dir = 1, draw = 0;
    bool d2 = 0, d4 = 0;
    rep(i,0,M){
        //cout << turn << " " << V[turn] << endl;
        string s;
        cin >> s;
        V[turn]++;
        if(i == M-1){
            cout << turn + 1 << " " << V[turn] << endl;
            break;
        }
        onemore:
        if(draw){
            if(d2 && s == "drawtwo" || d4 && s == "drawfour"){
                draw += (s == "drawtwo" ? 2 : 4);
            }else{
                d2 = d4 = 0;
                V[turn] -= draw;
                V[turn]--;
                draw = 0;
                turn = (turn + N + dir) % N;
                V[turn]++;
                goto onemore;
            }
        }else if(s == "drawtwo" || s == "drawfour"){
            draw += (s == "drawtwo" ? 2 : 4);
            (s == "drawtwo" ? d2 : d4) = 1;
        }else if(s == "skip"){
            turn += dir;
        }else if(s == "reverse"){
            dir *= -1;
        }

        turn = (turn + N + dir) % N;
    }
}
0