結果
| 問題 | No.1318 ABCD quadruplets |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2026-02-11 01:26:59 |
| 言語 | JavaScript (node v25.6.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,169 bytes |
| 記録 | |
| コンパイル時間 | 202 ms |
| コンパイル使用メモリ | 8,096 KB |
| 実行使用メモリ | 67,316 KB |
| 最終ジャッジ日時 | 2026-02-11 01:27:11 |
| 合計ジャッジ時間 | 11,133 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 11 TLE * 1 -- * 18 |
ソースコード
process.stdin.resume();
process.stdin.setEncoding("utf-8");
let inputString = '';
let currentLine = 0;
process.stdin.on('data', (inputStdin) => {
inputString += inputStdin;
})
process.stdin.on('end', (_) => {
inputString = inputString.trim().split('\n').map(string => {
return string.trim();
});
main();
})
function readLine() {
return inputString[currentLine++];
}
function main() {
const [N, M] = readLine().split(' ').map(x => parseInt(x, 10));
const result = new Array(N + 1).fill(0);
// a + ab + ac + ad + b + bc + bd + c + cd + d
for (let a = 0; a <= M; a++) {
for (let b = 0; b <= M; b++) {
for (let c = 0; c <= M; c++) {
for (let d = 0; d <= M; d++) {
const value = a*a + a*b + a*c + a*d +
b*b + b*c + b*d +
c*c + c*d +
d*d;
if (value <= N) {
result[value]++;
}
}
}
}
}
console.log(result.join(' '));
}
vjudge1