結果
問題 | No.769 UNOシミュレータ |
ユーザー |
|
提出日時 | 2018-12-17 04:17:23 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 31 ms / 2,000 ms |
コード長 | 847 bytes |
コンパイル時間 | 295 ms |
コンパイル使用メモリ | 31,360 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-22 08:46:41 |
合計ジャッジ時間 | 1,641 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
#include <stdio.h> int a[100000]; int main() { int n, m; scanf("%d %d", &n, &m); int i = 0; int j = -1; int d = 1; int two = 0; int four = 0; while (m--) { char c[10]; scanf("%s", c); if (two > 0 && c[4] != 't') { a[i] -= two; i = (i + d + n) % n; two = 0; } if (four > 0 && c[4] != 'f') { a[i] -= four; i = (i + d + n) % n; four = 0; } j = i; a[i]++; if (c[0] == 'r') { d *= -1; } else if (c[0] == 's') { i = (i + d + n) % n; } else if (c[4] == 't') { two += 2; } else if (c[4] == 'f') { four += 4; } i = (i + d + n) % n; } printf("%d %d\n", j + 1, a[j]); return 0; }