結果

問題 No.769 UNOシミュレータ
ユーザー sggkshiosggkshio
提出日時 2018-12-27 23:07:14
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,229 bytes
コンパイル時間 551 ms
コンパイル使用メモリ 85,056 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-14 12:04:23
合計ジャッジ時間 2,201 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include <sstream>
#include<iomanip>
#include <ctype.h>
#include <fstream>
#include <cassert>
//#include <bits/stdc++.h>
using namespace std;

//#include<bits/stdc++.h>

int t[100005];
	
int main() {

	int a, b;
	cin >> a >> b;
	int x = 0;
	int f = 1;
	bool c = 0, d = 0;
	int w = 0, r = 0;

	for (int i = 0; i < b; i++) {
		string p;
		cin >> p;
		if (w&&p == "drawtwo") {
			w++;
			t[x]++;
			if (i == b - 1)break;
			x = (x + f + a) % a;
			continue;
		}

		if (r&&p == "drawfour") {
			r++;
			t[x]++;
			if (i == b - 1)break;
			x = (x + f + a) % a;
			continue;
		}
		if (w) {
			t[x] -= w * 2;
			w = 0;
			x = (x + f + a) % a;
		}
		if (r) {
			t[x] -= r*4;
			r = 0;
			x = (x + f + a) % a;
		}
		t[x]++;
		if (p == "drawtwo")w++;
		else if (p == "drawfour")r++;
		else if(p=="skip")x = (x + f + a) % a;
		else if (p == "reverse")f *= -1;

		if (i == b - 1)break;
		x = (x + f + a) % a;

	}
	cout << x + 1 <<" "<<t[x]<< endl;

	return 0;
}
0