結果
問題 | No.769 UNOシミュレータ |
ユーザー |
![]() |
提出日時 | 2018-12-19 01:24:59 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,326 bytes |
コンパイル時間 | 1,574 ms |
コンパイル使用メモリ | 161,856 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-22 08:50:33 |
合計ジャッジ時間 | 3,182 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 WA * 12 |
ソースコード
#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 == "drawfour"){ 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; }