結果

問題 No.769 UNOシミュレータ
ユーザー chocoruskchocorusk
提出日時 2018-12-16 22:19:48
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,085 bytes
コンパイル時間 931 ms
コンパイル使用メモリ 94,200 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-14 11:52:08
合計ジャッジ時間 2,504 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n, m;
	cin>>n>>m;
	bool rev=0;
	int d2=0, d4=0;
	int id=0;
	int ct[100000]={};
	for(int i=0; i<m; i++){
		string s;
		cin>>s;
		if(d2 && s!="drawtwo"){
			ct[id]-=(2*d2);
			d2=0;
			if(rev) id=(id-1+n)%n;
			else id=(id+1)%n;
		}else if(d4 && s!="drawfour"){
			ct[id]-=(4*d4);
			d4=0;
			if(rev) id=(id-1+n)%n;
			else id=(id+1)%n;
		}
		ct[id]++;
		if(s=="skip"){
			if(rev) id=(id-1+n)%n;
			else id=(id+1)%n;
		}else if(s=="reverse"){
			if(rev) rev=0;
			else rev=1;
		}else if(s=="drawtwo"){
			d2++;
		}else if(s=="drawfour"){
			d4++;
		}
		if(i==m-1){
			cout<<id+1<<" "<<ct[id]<<endl;
			return 0;
		}
		if(rev) id=(id-1+n)%n;
		else id=(id+1)%n;
	}
	return 0;
}
0