結果

問題 No.1318 ABCD quadruplets
ユーザー 👑 tatyamtatyam
提出日時 2020-07-17 23:36:28
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 209 ms / 2,000 ms
コード長 964 bytes
コンパイル時間 3,353 ms
コンパイル使用メモリ 221,452 KB
実行使用メモリ 9,888 KB
最終ジャッジ日時 2024-05-07 11:50:11
合計ジャッジ時間 7,564 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
9,596 KB
testcase_01 AC 5 ms
9,532 KB
testcase_02 AC 6 ms
9,580 KB
testcase_03 AC 5 ms
9,888 KB
testcase_04 AC 5 ms
9,676 KB
testcase_05 AC 4 ms
9,532 KB
testcase_06 AC 5 ms
9,676 KB
testcase_07 AC 6 ms
9,732 KB
testcase_08 AC 6 ms
9,680 KB
testcase_09 AC 5 ms
9,668 KB
testcase_10 AC 5 ms
9,876 KB
testcase_11 AC 5 ms
9,684 KB
testcase_12 AC 4 ms
9,768 KB
testcase_13 AC 9 ms
9,732 KB
testcase_14 AC 79 ms
9,780 KB
testcase_15 AC 6 ms
9,740 KB
testcase_16 AC 108 ms
9,696 KB
testcase_17 AC 14 ms
9,672 KB
testcase_18 AC 71 ms
9,784 KB
testcase_19 AC 33 ms
9,724 KB
testcase_20 AC 8 ms
9,668 KB
testcase_21 AC 16 ms
9,588 KB
testcase_22 AC 16 ms
9,540 KB
testcase_23 AC 207 ms
9,736 KB
testcase_24 AC 185 ms
9,644 KB
testcase_25 AC 45 ms
9,656 KB
testcase_26 AC 28 ms
9,704 KB
testcase_27 AC 135 ms
9,680 KB
testcase_28 AC 51 ms
9,656 KB
testcase_29 AC 62 ms
9,668 KB
testcase_30 AC 209 ms
9,804 KB
testcase_31 AC 47 ms
9,772 KB
testcase_32 AC 208 ms
9,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;

int main(){
    int n, m;
    cin >> n >> m;
    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