結果

問題 No.1318 ABCD quadruplets
ユーザー りあんりあん
提出日時 2020-12-15 04:02:04
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 369 ms / 2,000 ms
コード長 1,305 bytes
コンパイル時間 3,113 ms
コンパイル使用メモリ 193,448 KB
最終ジャッジ日時 2025-01-17 00:56:02
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using P = pair<long long, int>;
const long long LM = 1LL << 60;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    int n, m;
    cin >> n >> m;
    vector<int> cnt(n + 1);
    for (int i = 0; i <= m; ++i) {
        int sa = i * i;
        for (int j = 0; j <= i; ++j) {
            int sb = sa + (i + j) * j;
            for (int k = 0; k <= j; ++k) {
                int sc = sb + (i + j + k) * k;
                for (int l = 0; l <= k; ++l) {
                    int sd = sc + (i + j + k + l) * l;
                    int c = (i == j) + (i == k) + (i == l) + (j == k) + (j == l) + (k == l);
                    if (sd > n) break;
                    if (c == 0) {
                        cnt[sd] += 24;
                    }
                    else if (c == 1) {
                        cnt[sd] += 12;
                    }
                    else if (c == 2) {
                        cnt[sd] += 6;
                    }
                    else if (c == 3) {
                        cnt[sd] += 4;
                    }
                    else if (c == 6) {
                        cnt[sd] += 1;
                    }
                }
            }
        }
    }
    for (auto& i : cnt) {
        cout << i << '\n';
    }
    return 0;
}
0