結果
問題 | No.602 隠されていたゲーム2 |
ユーザー | locol23 |
提出日時 | 2021-12-01 10:58:34 |
言語 | TypeScript (5.4.3) |
結果 |
WA
|
実行時間 | - |
コード長 | 826 bytes |
コンパイル時間 | 7,517 ms |
コンパイル使用メモリ | 255,416 KB |
実行使用メモリ | 58,960 KB |
最終ジャッジ日時 | 2023-09-17 15:07:10 |
合計ジャッジ時間 | 11,072 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 81 ms
42,260 KB |
testcase_01 | AC | 80 ms
42,240 KB |
testcase_02 | AC | 80 ms
42,172 KB |
testcase_03 | AC | 81 ms
42,232 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 80 ms
42,420 KB |
testcase_07 | AC | 79 ms
42,352 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 79 ms
42,364 KB |
testcase_16 | AC | 91 ms
44,056 KB |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 147 ms
56,712 KB |
testcase_21 | AC | 146 ms
56,704 KB |
testcase_22 | WA | - |
testcase_23 | AC | 150 ms
56,872 KB |
ソースコード
import * as fs from 'fs' const main = () => { const input = fs.readFileSync('/dev/stdin', 'utf8').split('\n') const [n] = input[0].split(' ').map((x: string): number => +x) const d = input[1].split(' ').map((x: string): number => +x) const [x, y] = input[2].split(' ').map((x: string) => +x) const targetDistance = Math.abs(x) + Math.abs(y) let incrementAcc = 0 let decrementAcc = 0 for (let i = 0, len = n; i < len; i++) { if (targetDistance === 0) { return console.log(0) } if (d[i] === targetDistance) { return console.log(1) } if (incrementAcc === targetDistance) { return console.log(2) } if (decrementAcc === targetDistance) { return console.log(2) } incrementAcc += d[i] decrementAcc -= d[i] } return console.log(-1) } main()