結果

問題 No.1318 ABCD quadruplets
ユーザー milanis48663220milanis48663220
提出日時 2020-12-15 02:10:25
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 462 ms / 2,000 ms
コード長 1,552 bytes
コンパイル時間 870 ms
コンパイル使用メモリ 96,336 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 05:37:30
合計ジャッジ時間 7,287 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 3 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 24 ms
4,348 KB
testcase_14 AC 255 ms
4,348 KB
testcase_15 AC 23 ms
4,348 KB
testcase_16 AC 260 ms
4,348 KB
testcase_17 AC 133 ms
4,348 KB
testcase_18 AC 227 ms
4,348 KB
testcase_19 AC 201 ms
4,348 KB
testcase_20 AC 23 ms
4,348 KB
testcase_21 AC 56 ms
4,348 KB
testcase_22 AC 196 ms
4,348 KB
testcase_23 AC 458 ms
4,348 KB
testcase_24 AC 433 ms
4,348 KB
testcase_25 AC 236 ms
4,348 KB
testcase_26 AC 216 ms
4,348 KB
testcase_27 AC 357 ms
4,348 KB
testcase_28 AC 243 ms
4,348 KB
testcase_29 AC 260 ms
4,348 KB
testcase_30 AC 455 ms
4,348 KB
testcase_31 AC 239 ms
4,348 KB
testcase_32 AC 462 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cassert>

#define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl;
#define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using namespace std;
typedef long long ll;

int sq(int x){ return x*x; }

int calc(int a, int b, int c, int d){
    return (sq(a+b+c+d)+sq(a)+sq(b)+sq(c)+sq(d))/2;
}

ll f[8] = {1, 4, 6, 12, 4, 12, 12, 24};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int n, m; cin >> n >> m;
    vector<int> ans(n+1);
    int cnt_all = 0;
    for(int a = 0; a <= m; a++){
        for(int b = a; b <= m; b++){
            if(calc(a, b, 0, 0) > n) break;
            for(int c = b; c <= m; c++){
                if(calc(a, b, c, 0) > n) break;
                for(int d = c; d <= m; d++){
                    int x = calc(a, b, c, d);
                    // cout << x << ' ';
                    if(x > n) break;
                    int s = 0;
                    if(a != b) s += 1;
                    if(b != c) s += 2;
                    if(c != d) s += 4;
                    ans[x] += f[s];
                }
            }
        }
    }
    for(int x: ans) cout << x << endl;
}
0