結果

問題 No.1318 ABCD quadruplets
ユーザー 👑 tatyamtatyam
提出日時 2020-12-14 23:55:55
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 216 ms / 2,000 ms
コード長 1,059 bytes
コンパイル時間 9,020 ms
コンパイル使用メモリ 308,064 KB
実行使用メモリ 10,136 KB
最終ジャッジ日時 2023-10-20 05:16:32
合計ジャッジ時間 11,471 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
10,136 KB
testcase_01 AC 5 ms
10,136 KB
testcase_02 AC 4 ms
10,136 KB
testcase_03 AC 4 ms
10,136 KB
testcase_04 AC 5 ms
10,136 KB
testcase_05 AC 5 ms
10,136 KB
testcase_06 AC 4 ms
10,136 KB
testcase_07 AC 5 ms
10,136 KB
testcase_08 AC 4 ms
10,136 KB
testcase_09 AC 5 ms
10,136 KB
testcase_10 AC 5 ms
10,136 KB
testcase_11 AC 4 ms
10,136 KB
testcase_12 AC 5 ms
10,136 KB
testcase_13 AC 8 ms
10,136 KB
testcase_14 AC 83 ms
10,136 KB
testcase_15 AC 6 ms
10,136 KB
testcase_16 AC 108 ms
10,136 KB
testcase_17 AC 13 ms
10,136 KB
testcase_18 AC 73 ms
10,136 KB
testcase_19 AC 34 ms
10,136 KB
testcase_20 AC 7 ms
10,136 KB
testcase_21 AC 17 ms
10,136 KB
testcase_22 AC 15 ms
10,136 KB
testcase_23 AC 216 ms
10,136 KB
testcase_24 AC 192 ms
10,136 KB
testcase_25 AC 47 ms
10,136 KB
testcase_26 AC 28 ms
10,136 KB
testcase_27 AC 142 ms
10,136 KB
testcase_28 AC 53 ms
10,136 KB
testcase_29 AC 65 ms
10,136 KB
testcase_30 AC 213 ms
10,136 KB
testcase_31 AC 49 ms
10,136 KB
testcase_32 AC 213 ms
10,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "testlib.h"
#include <bits/stdc++.h>
using namespace std;

int main(){
    registerValidation();
    int n, m;
    n = inf.readInt(1, 160000);
    inf.readSpace();
    m = inf.readInt(1, (int)sqrt(n));
    inf.readEoln();
    inf.readEof();
    int ans[1600001] = {};
    for(int a = 0; a <= m; a++) for(int b = 0; b <= a; b++) for(int c = 0; c <= b; c++) for(int d = 0; d <= c; d++){
        const int k = a * a + b * (a + b) + c * (a + b + c) + d * (a + b + c + 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;
            }
        }
    }
    for(int i = 0; i <= n; i++) cout << ans[i] << '\n';
}
0