結果

問題 No.769 UNOシミュレータ
ユーザー furafura
提出日時 2020-04-13 03:42:53
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 904 bytes
コンパイル時間 2,258 ms
コンパイル使用メモリ 201,848 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-02 00:47:39
合計ジャッジ時間 3,937 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int n,m; scanf("%d%d",&n,&m);

	int id=0,d=1,last=0,draw=0;
	vector<int> num(n);
	rep(i,m){
		id%=n;

		string s; cin>>s;

		if(draw>0){
			if(s=="drawtwo" && last==2){
				num[id]++;
				id=(id+d+n)%n;
				draw+=2;
				continue;
			}
			else if(s=="drawfour" && last==4){
				num[id]++;
				id=(id+d+n)%n;
				draw+=4;
				continue;
			}
			else{
				num[id]+=draw;
				id=(id+d+n)%n;
				draw=0;
			}
		}

		if(s=="number"){
			num[id]++;
			id=(id+d+n)%n;
		}
		else if(s=="drawtwo"){
			num[id]++;
			id=(id+d+n)%n;
			draw=last=2;
		}
		else if(s=="drawfour"){
			num[id]++;
			id=(id+d+n)%n;
			draw=last=4;
		}
		else if(s=="skip"){
			num[id]++;
			id=(id+2*d+n)%n;
		}
		else{ // reverse
			num[id]++;
			d*=-1;
			id=(id+d+n)%n;
		}
	}

	printf("%d %d\n",id==0?n:id,num[id-1]);

	return 0;
}
0