結果

問題 No.1318 ABCD quadruplets
ユーザー 👑 tatyamtatyam
提出日時 2020-07-12 04:12:30
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 244 ms / 2,000 ms
コード長 919 bytes
コンパイル時間 2,249 ms
コンパイル使用メモリ 195,096 KB
実行使用メモリ 9,940 KB
最終ジャッジ日時 2024-04-21 21:36:29
合計ジャッジ時間 5,604 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
9,756 KB
testcase_01 AC 4 ms
9,872 KB
testcase_02 AC 4 ms
9,756 KB
testcase_03 AC 4 ms
9,876 KB
testcase_04 AC 4 ms
9,824 KB
testcase_05 AC 3 ms
9,940 KB
testcase_06 AC 4 ms
9,704 KB
testcase_07 AC 4 ms
9,804 KB
testcase_08 AC 4 ms
9,832 KB
testcase_09 AC 4 ms
9,700 KB
testcase_10 AC 4 ms
9,852 KB
testcase_11 AC 3 ms
9,776 KB
testcase_12 AC 4 ms
9,772 KB
testcase_13 AC 7 ms
9,676 KB
testcase_14 AC 88 ms
9,692 KB
testcase_15 AC 5 ms
9,700 KB
testcase_16 AC 124 ms
9,668 KB
testcase_17 AC 12 ms
9,680 KB
testcase_18 AC 80 ms
9,696 KB
testcase_19 AC 35 ms
9,672 KB
testcase_20 AC 7 ms
9,736 KB
testcase_21 AC 17 ms
9,656 KB
testcase_22 AC 14 ms
9,772 KB
testcase_23 AC 235 ms
9,880 KB
testcase_24 AC 213 ms
9,760 KB
testcase_25 AC 49 ms
9,800 KB
testcase_26 AC 29 ms
9,780 KB
testcase_27 AC 153 ms
9,860 KB
testcase_28 AC 57 ms
9,880 KB
testcase_29 AC 69 ms
9,788 KB
testcase_30 AC 244 ms
9,720 KB
testcase_31 AC 51 ms
9,776 KB
testcase_32 AC 241 ms
9,788 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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 + 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;
            }
        }
    }
    for(int i = 0; i <= n; i++) cout << ans[i] << '\n';
}
0