結果
問題 |
No.769 UNOシミュレータ
|
ユーザー |
![]() |
提出日時 | 2019-03-15 18:22:19 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 45 ms / 2,000 ms |
コード長 | 1,628 bytes |
コンパイル時間 | 2,109 ms |
コンパイル使用メモリ | 200,492 KB |
最終ジャッジ日時 | 2025-01-06 22:11:56 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
#include<bits/stdc++.h> using namespace std; using Int = long long; template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;} struct FastIO{ FastIO(){ cin.tie(0); ios::sync_with_stdio(0); } }fastio_beet; //INSERT ABOVE HERE signed main(){ Int n,m; cin>>n>>m; vector<Int> cnt(n,0),draw(n,0); Int way=1,idx=0; vector<string> vs(m); for(Int i=0;i<m;i++) cin>>vs[i]; for(Int i=0;i<m;i++){ cnt[idx]++; if(i+1==m) break; string s=vs[i]; if(s=="number"s){ idx+=n+way; idx%=n; continue; } if(s=="skip"s){ idx+=(n+way)*2; idx%=n; continue; } if(s=="reverse"s){ way*=-1; idx+=n+way; idx%=n; continue; } cnt[idx]--; if(s=="drawtwo"){ Int j=i,flg=0; while(j<m&&vs[j]=="drawtwo"s){ cnt[idx]++; if(j+1==m){ flg=1; break; } idx+=n+way; idx%=n; j++; } if(flg) break; draw[idx]+=(j-i)*2; idx+=n+way; idx%=n; i=j-1; continue; } if(s=="drawfour"){ Int j=i,flg=0; while(j<m&&vs[j]=="drawfour"s){ cnt[idx]++; if(j+1==m){ flg=1; break; } idx+=n+way; idx%=n; j++; } if(flg) break; draw[idx]+=(j-i)*4; idx+=n+way; idx%=n; i=j-1; continue; } } cout<<idx+1<<" "<<cnt[idx]-draw[idx]<<endl; return 0; }