結果

問題 No.1318 ABCD quadruplets
ユーザー 👑 箱
提出日時 2020-12-21 12:23:05
言語 Kotlin
(1.9.23)
結果
TLE  
実行時間 -
コード長 1,653 bytes
コンパイル時間 16,646 ms
コンパイル使用メモリ 444,088 KB
実行使用メモリ 82,740 KB
最終ジャッジ日時 2023-10-21 11:37:55
合計ジャッジ時間 35,588 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 285 ms
57,648 KB
testcase_01 AC 273 ms
57,640 KB
testcase_02 AC 284 ms
57,648 KB
testcase_03 AC 273 ms
57,576 KB
testcase_04 AC 277 ms
57,568 KB
testcase_05 AC 285 ms
57,580 KB
testcase_06 AC 285 ms
57,576 KB
testcase_07 AC 289 ms
57,572 KB
testcase_08 AC 276 ms
57,564 KB
testcase_09 AC 290 ms
57,572 KB
testcase_10 AC 288 ms
57,568 KB
testcase_11 AC 279 ms
57,580 KB
testcase_12 AC 290 ms
57,572 KB
testcase_13 AC 431 ms
60,132 KB
testcase_14 AC 1,168 ms
79,804 KB
testcase_15 AC 430 ms
60,132 KB
testcase_16 AC 1,277 ms
72,668 KB
testcase_17 AC 441 ms
60,000 KB
testcase_18 AC 1,049 ms
76,708 KB
testcase_19 AC 634 ms
62,408 KB
testcase_20 AC 433 ms
60,152 KB
testcase_21 AC 505 ms
60,276 KB
testcase_22 AC 441 ms
59,952 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 AC 770 ms
68,636 KB
testcase_26 AC 537 ms
62,076 KB
testcase_27 AC 1,892 ms
79,796 KB
testcase_28 AC 821 ms
72,720 KB
testcase_29 AC 996 ms
79,872 KB
testcase_30 TLE -
testcase_31 AC 797 ms
70,664 KB
testcase_32 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.PrintWriter
import java.util.*
import kotlin.math.*

fun PrintWriter.solve() {
    val n = nextInt()
    val m = nextInt()
    val ans = Array(n + 1) { 0 }
    for (a in 0..m) {
        for (b in 0..a) {
            for (c in 0..b) {
                for (d in 0..c) {
                    val k = a * a + a * b + a * c + a * d + b * b + b * c + b * d + c * c + c * d + d * d
                    if (k > n) break
                    if (a == b) {
                        if (b == c) {
                            if (c == d) ans[k] += 1
                            else ans[k] += 4
                        } else {
                            if (c == d) ans[k] += 6
                            else ans[k] += 12
                        }
                    } else {
                        if (b == c) {
                            if (c == d) ans[k] += 4
                            else ans[k] += 12
                        } else {
                            if (c == d) ans[k] += 12
                            else ans[k] += 24
                        }
                    }
                }
            }
        }
    }
    println(ans.joinToString("\n"))
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve()
    writer.flush()
}

// region Scanner
private var st = StringTokenizer("")
private val br = System.`in`.bufferedReader()

fun next(): String {
    while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())
    return st.nextToken()
}

fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextLine() = br.readLine()!!
fun nextDouble() = next().toDouble()
// endregion
0