結果

問題 No.1318 ABCD quadruplets
ユーザー 👑 hos.lyrichos.lyric
提出日時 2020-12-15 00:29:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 3,307 bytes
コンパイル時間 1,484 ms
コンパイル使用メモリ 111,304 KB
実行使用メモリ 4,492 KB
最終ジャッジ日時 2023-10-20 05:23:03
合計ジャッジ時間 3,531 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 2 ms
4,396 KB
testcase_03 AC 3 ms
4,396 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,396 KB
testcase_06 WA -
testcase_07 AC 3 ms
4,396 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 2 ms
4,396 KB
testcase_12 AC 2 ms
4,396 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 12 ms
4,396 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 16 ms
4,396 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 29 ms
4,396 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx")

#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

using Int = long long;

template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }


int N, M;

int main() {
  for (; ~scanf("%d%d", &N, &M); ) {
    int ans[160'010] = {};
    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 s = ((a+b+c+d)*(a+b+c+d) + a*a + b*b + c*c + d*d) / 2;
            if (s > N) {
              break;
            }
            ans[s] += 24;
          }
          {
            #define d c
            const int s = ((a+b+c+d)*(a+b+c+d) + a*a + b*b + c*c + d*d) / 2;
            #undef d
            if (s > N) {
              break;
            }
            ans[s] += 12;
          }
        }
        #define c b
        {
          for (int d = 0; d < c; ++d) {
            const int s = ((a+b+c+d)*(a+b+c+d) + a*a + b*b + c*c + d*d) / 2;
            if (s > N) {
              break;
            }
            ans[s] += 12;
          }
          #define d c
          {
            const int s = ((a+b+c+d)*(a+b+c+d) + a*a + b*b + c*c + d*d) / 2;
            if (s > N) {
              break;
            }
            ans[s] += 4;
          }
          #undef d
        }
        #undef c
      }
      #define b a
      {
        for (int c = 0; c < b; ++c) {
          for (int d = 0; d < c; ++d) {
            const int s = ((a+b+c+d)*(a+b+c+d) + a*a + b*b + c*c + d*d) / 2;
            if (s > N) {
              break;
            }
            ans[s] += 12;
          }
          #define d c
          {
            const int s = ((a+b+c+d)*(a+b+c+d) + a*a + b*b + c*c + d*d) / 2;
            if (s > N) {
              break;
            }
            ans[s] += 6;
          }
          #undef d
        }
        #define c b
        {
          for (int d = 0; d < c; ++d) {
            const int s = ((a+b+c+d)*(a+b+c+d) + a*a + b*b + c*c + d*d) / 2;
            if (s > N) {
              break;
            }
            ans[s] += 4;
          }
          #define d c
          {
            const int s = ((a+b+c+d)*(a+b+c+d) + a*a + b*b + c*c + d*d) / 2;
            if (s > N) {
              break;
            }
            ans[s] += 1;
          }
          #undef d
        }
        #undef c
      }
      #undef b
    }
    for (int s = 0; s <= N; ++s) {
      printf("%d\n", ans[s]);
    }
  }
  return 0;
}
0