結果
問題 | No.769 UNOシミュレータ |
ユーザー | pengin_2000 |
提出日時 | 2021-03-14 00:59:09 |
言語 | C (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,335 bytes |
コンパイル時間 | 139 ms |
コンパイル使用メモリ | 30,464 KB |
実行使用メモリ | 7,296 KB |
最終ジャッジ日時 | 2024-10-15 14:25:08 |
合計ジャッジ時間 | 1,916 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | AC | 1 ms
5,248 KB |
testcase_02 | AC | 1 ms
5,248 KB |
testcase_03 | AC | 1 ms
5,248 KB |
testcase_04 | AC | 1 ms
5,248 KB |
testcase_05 | AC | 1 ms
5,248 KB |
testcase_06 | AC | 1 ms
5,248 KB |
testcase_07 | AC | 1 ms
5,248 KB |
testcase_08 | AC | 1 ms
5,248 KB |
testcase_09 | AC | 2 ms
5,248 KB |
testcase_10 | AC | 2 ms
5,248 KB |
testcase_11 | AC | 2 ms
5,248 KB |
testcase_12 | AC | 13 ms
5,248 KB |
testcase_13 | AC | 12 ms
5,248 KB |
testcase_14 | AC | 12 ms
5,248 KB |
testcase_15 | AC | 24 ms
5,248 KB |
testcase_16 | AC | 25 ms
5,248 KB |
testcase_17 | AC | 27 ms
5,376 KB |
testcase_18 | AC | 35 ms
7,168 KB |
testcase_19 | AC | 35 ms
7,168 KB |
testcase_20 | AC | 34 ms
7,296 KB |
testcase_21 | AC | 35 ms
7,296 KB |
testcase_22 | WA | - |
ソースコード
#include<stdio.h> int main() { long long int n, m; scanf("%lld %lld", &n, &m); char l[300005][16]; long long int i; for (i = 0; i < m; i++) scanf("%s", l[i]); long long int now = 0, step = 1, stack = 0; long long int cnt[100005]; for (i = 0; i < n; i++) cnt[i] = 0; for (i = 0; i < m; i++) { if (l[i][0] == 'n') { if (stack > 0) { cnt[now] -= stack; stack = 0; now = (now + n + step) % n; cnt[now]++; now = (now + n + step) % n; } else { cnt[now]++; now = (now + n + step) % n; } } else if (l[i][0] == 's') { if (stack > 0) { cnt[now] -= stack; stack = 0; now = (now + n + step) % n; cnt[now]++; now = (now + n + step) % n; now = (now + n + step) % n; } else { cnt[now]++; now = (now + n + step) % n; now = (now + n + step) % n; } } else if (l[i][0] == 'r') { if (stack > 0) { cnt[now] -= stack; stack = 0; now = (now + n + step) % n; cnt[now]++; step *= -1; now = (now + n + step) % n; } else { cnt[now]++; step *= -1; now = (now + n + step) % n; } } else if (l[i][4] == 't') { if (i > 0) { if (l[i - 1][0] == 'd' && l[i - 1][4] == 't') { cnt[now]++; stack += 2; now = (now + n + step) % n; } else { if (stack > 0) { cnt[now] -= stack; stack = 0; now = (now + n + step) % n; cnt[now]++; stack += 2; now = (now + n + step) % n; } else { cnt[now]++; stack += 2; now = (now + n + step) % n; } } } else { cnt[now]++; stack += 2; now = (now + n + step) % n; } } else { if (i > 0) { if (l[i - 1][0] == 'd' && l[i - 1][4] == 'f') { cnt[now]++; stack += 4; now = (now + n + step) % n; } else { if (stack > 0) { cnt[now] -= stack; stack = 0; now = (now + n + step) % n; cnt[now]++; stack += 4; now = (now + n + step) % n; } else { cnt[now]++; stack += 4; now = (now + n + step) % n; } } } else { cnt[now]++; stack += 4; now = (now + n + step) % n; } } } now = (now + n - step) % n; printf("%lld %lld\n", now + 1, cnt[now]); return 0; }