結果

問題 No.769 UNOシミュレータ
ユーザー sigma425sigma425
提出日時 2018-12-19 01:24:33
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,325 bytes
コンパイル時間 1,147 ms
コンパイル使用メモリ 162,612 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-02 00:13:11
合計ジャッジ時間 2,653 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
int main(){
	int N,M;
	cin>>N>>M;
	V<int> a(N);
	int x = 0;
	int d = 1;
	string prev;
	int px = -1;
	rep(i,M){
		px = x;
		string s;
		cin>>s;
		a[x]--;
		if(s == "number"){
			x = (x+d+N)%N;
		}
		if(s == "skip"){
			x = (x+d+d+N)%N;
		}
		if(s == "reverse"){
			d = -d;
			x = (x+d+N)%N;
		}
		if(s == "drawtwo"){
			if(prev == "drawtwo"){
				a[x]++;
				x = (x-d+N)%N;
				a[x]--;
			}
			a[(x+d+N)%N] += 2;
			x = (x+d+d+N)%N;
		}
		if(s == "drawfour"){
			if(prev == "drawtwo"){
				a[x]++;
				x = (x-d+N)%N;
				a[x]--;
			}
			a[(x+d+N)%N] += 4;
			x = (x+d+d+N)%N;
		}
		prev = s;
	}
	cout<<px+1<<" "<<-a[px]<<endl;
}
0