結果
| 問題 |
No.602 隠されていたゲーム2
|
| コンテスト | |
| ユーザー |
locol23
|
| 提出日時 | 2021-12-01 10:53:31 |
| 言語 | TypeScript (5.7.2) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 604 bytes |
| コンパイル時間 | 8,755 ms |
| コンパイル使用メモリ | 230,688 KB |
| 実行使用メモリ | 53,336 KB |
| 最終ジャッジ日時 | 2024-12-31 16:41:21 |
| 合計ジャッジ時間 | 11,894 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 WA * 14 |
ソースコード
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 acc = 0
for (let i = 0, len = n; i < len; i++) {
if (d[i] === targetDistance) {
return console.log(1)
}
if (acc === targetDistance) {
return console.log(2)
}
acc += d[i]
}
return console.log(-1)
}
main()
locol23