結果
問題 | No.2373 wa, wo, n |
ユーザー | nwo |
提出日時 | 2023-06-16 18:59:23 |
言語 | JavaScript (node v21.7.1) |
結果 |
AC
|
実行時間 | 503 ms / 2,000 ms |
コード長 | 1,950 bytes |
コンパイル時間 | 153 ms |
コンパイル使用メモリ | 5,120 KB |
実行使用メモリ | 108,516 KB |
最終ジャッジ日時 | 2024-07-02 11:26:06 |
合計ジャッジ時間 | 12,195 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 66 ms
40,576 KB |
testcase_01 | AC | 63 ms
40,448 KB |
testcase_02 | AC | 64 ms
40,576 KB |
testcase_03 | AC | 63 ms
40,704 KB |
testcase_04 | AC | 65 ms
40,960 KB |
testcase_05 | AC | 64 ms
40,704 KB |
testcase_06 | AC | 65 ms
40,576 KB |
testcase_07 | AC | 67 ms
40,576 KB |
testcase_08 | AC | 64 ms
40,576 KB |
testcase_09 | AC | 67 ms
40,960 KB |
testcase_10 | AC | 67 ms
40,960 KB |
testcase_11 | AC | 68 ms
40,448 KB |
testcase_12 | AC | 69 ms
40,704 KB |
testcase_13 | AC | 66 ms
40,448 KB |
testcase_14 | AC | 398 ms
94,336 KB |
testcase_15 | AC | 124 ms
60,536 KB |
testcase_16 | AC | 450 ms
98,964 KB |
testcase_17 | AC | 141 ms
64,768 KB |
testcase_18 | AC | 88 ms
48,512 KB |
testcase_19 | AC | 159 ms
69,248 KB |
testcase_20 | AC | 314 ms
94,080 KB |
testcase_21 | AC | 155 ms
69,888 KB |
testcase_22 | AC | 192 ms
77,312 KB |
testcase_23 | AC | 469 ms
103,448 KB |
testcase_24 | AC | 69 ms
40,960 KB |
testcase_25 | AC | 71 ms
40,576 KB |
testcase_26 | AC | 73 ms
40,576 KB |
testcase_27 | AC | 67 ms
40,576 KB |
testcase_28 | AC | 67 ms
41,088 KB |
testcase_29 | AC | 65 ms
40,576 KB |
testcase_30 | AC | 66 ms
40,576 KB |
testcase_31 | AC | 68 ms
40,576 KB |
testcase_32 | AC | 482 ms
108,404 KB |
testcase_33 | AC | 467 ms
108,016 KB |
testcase_34 | AC | 503 ms
107,632 KB |
testcase_35 | AC | 468 ms
107,376 KB |
testcase_36 | AC | 478 ms
107,380 KB |
testcase_37 | AC | 469 ms
107,632 KB |
testcase_38 | AC | 475 ms
107,380 KB |
testcase_39 | AC | 473 ms
107,368 KB |
testcase_40 | AC | 473 ms
108,516 KB |
testcase_41 | AC | 481 ms
108,136 KB |
testcase_42 | AC | 478 ms
107,432 KB |
ソースコード
const readline = require('readline'); const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); rl.on('line', (line) => { const N = parseInt(line); rl.on('line', (line) => { const S = line.trim(); const dp = new Array(N).fill(false).map(() => new Array(26).fill(false)); if (S[0] === '?') { for (let j = 0; j < 26; j++) { dp[0][j] = true; } } if (S[0] === 'n') { dp[0]['n'.charCodeAt(0) - 'a'.charCodeAt(0)] = true; } if (S[0] === 'w') { dp[0]['w'.charCodeAt(0) - 'a'.charCodeAt(0)] = true; } if (S[0] === 'a' || S[0] === 'o') { console.log("No"); process.exit(0); } for (let i = 1; i < N; i++) { for (let j = 0; j < 26; j++) { if (dp[i - 1][j] === true) { if (j === 'w'.charCodeAt(0) - 'a'.charCodeAt(0)) { if (S[i] === 'a') dp[i]['a'.charCodeAt(0) - 'a'.charCodeAt(0)] = true; if (S[i] === 'o') dp[i]['o'.charCodeAt(0) - 'a'.charCodeAt(0)] = true; if (S[i] === '?') { dp[i]['a'.charCodeAt(0) - 'a'.charCodeAt(0)] = true; dp[i]['o'.charCodeAt(0) - 'a'.charCodeAt(0)] = true; } } else { if (S[i] === 'w') dp[i]['w'.charCodeAt(0) - 'a'.charCodeAt(0)] = true; if (S[i] === 'n') dp[i]['n'.charCodeAt(0) - 'a'.charCodeAt(0)] = true; if (S[i] === '?') { dp[i]['w'.charCodeAt(0) - 'a'.charCodeAt(0)] = true; dp[i]['n'.charCodeAt(0) - 'a'.charCodeAt(0)] = true; } } } } } let ans = false; if (dp[N - 1]['a'.charCodeAt(0) - 'a'.charCodeAt(0)]) ans = true; if (dp[N - 1]['o'.charCodeAt(0) - 'a'.charCodeAt(0)]) ans = true; if (dp[N - 1]['n'.charCodeAt(0) - 'a'.charCodeAt(0)]) ans = true; if (ans === true) console.log("Yes"); else console.log("No"); process.exit(0); }); });