結果

問題 No.1318 ABCD quadruplets
ユーザー 👑 hos.lyrichos.lyric
提出日時 2020-12-15 00:13:37
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,636 bytes
コンパイル時間 944 ms
コンパイル使用メモリ 98,768 KB
実行使用メモリ 8,496 KB
最終ジャッジ日時 2023-10-20 05:19:29
合計ジャッジ時間 9,254 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,372 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 1 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 1 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 34 ms
4,348 KB
testcase_14 AC 1,075 ms
4,348 KB
testcase_15 AC 10 ms
4,348 KB
testcase_16 AC 1,477 ms
4,348 KB
testcase_17 AC 26 ms
4,348 KB
testcase_18 AC 923 ms
4,348 KB
testcase_19 AC 299 ms
4,372 KB
testcase_20 AC 29 ms
4,348 KB
testcase_21 AC 140 ms
4,348 KB
testcase_22 AC 18 ms
4,444 KB
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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 ans[200'010];

int main() {
  for (; ~scanf("%d%d", &N, &M); ) {
    fill(ans, ans + N + 1, 0);
    for (int a = 0; a <= M; ++a) {
      for (int b = 0; b <= M; ++b) {
        const int s2 = a * a + (a + b) * b;
        if (s2 > N) {
          break;
        }
        for (int c = 0; c <= M; ++c) {
          const int s3 = s2 + (a + b + c) * c;
          if (s3 > N) {
            break;
          }
          for (int d = 0; d <= M; ++d) {
            const int s4 = s3 + (a + b + c + d) * d;
            if (s4 > N) {
              break;
            }
            ++ans[s4];
          }
        }
      }
    }
    for (int s = 0; s <= N; ++s) {
      printf("%d\n", ans[s]);
    }
  }
  return 0;
}
0