Submission #66938978
Source Code Expand
function main(stdin) {
const lines = stdin.trim().split('\n')
const n = Number(lines[0])
const d = lines[1].split(' ').map(Number)
const prefix = Array.from({ length: n }, () => 0)
for (let i = 1; i <= n; i++) {
prefix[i] = prefix[i - 1] + d[i - 1]
}
const res = []
for (let i = 0; i < n - 1; i++) {
const ans = []
for (let j = i + 1; j < n; j++) {
ans.push(prefix[j] - prefix[i])
}
res.push(ans.join(' '))
}
return res.join('\n')
}
if (require.main === module) {
const fs = require('node:fs')
const input = fs.readFileSync('/dev/stdin', 'utf8')
console.log(main(input))
}
module.exports = { main }
Submission Info
| Submission Time | |
|---|---|
| Task | B - Distance Table |
| User | xhksun |
| Language | JavaScript (Node.js 18.16.1) |
| Score | 200 |
| Code Size | 679 Byte |
| Status | AC |
| Exec Time | 40 ms |
| Memory | 43024 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example_00.txt, example_01.txt |
| All | example_00.txt, example_01.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| example_00.txt | AC | 40 ms | 42500 KiB |
| example_01.txt | AC | 40 ms | 42688 KiB |
| hand_00.txt | AC | 40 ms | 43024 KiB |
| hand_01.txt | AC | 40 ms | 42704 KiB |
| hand_02.txt | AC | 40 ms | 42748 KiB |
| hand_03.txt | AC | 40 ms | 42660 KiB |
| hand_04.txt | AC | 40 ms | 42724 KiB |
| random_00.txt | AC | 40 ms | 42792 KiB |
| random_01.txt | AC | 40 ms | 42928 KiB |
| random_02.txt | AC | 40 ms | 42936 KiB |
| random_03.txt | AC | 40 ms | 42792 KiB |
| random_04.txt | AC | 40 ms | 42960 KiB |
| random_05.txt | AC | 40 ms | 42968 KiB |
| random_06.txt | AC | 40 ms | 42944 KiB |
| random_07.txt | AC | 40 ms | 42900 KiB |
| random_08.txt | AC | 40 ms | 42896 KiB |
| random_09.txt | AC | 40 ms | 42932 KiB |