結果

問題 No.1318 ABCD quadruplets
ユーザー tnakao0123
提出日時 2020-12-19 01:21:33
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 203 ms / 2,000 ms
コード長 1,207 bytes
コンパイル時間 902 ms
コンパイル使用メモリ 95,956 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-21 09:39:51
合計ジャッジ時間 4,453 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

/* -*- coding: utf-8 -*-
*
* 1318.cc: No.1318 ABCD quadruplets - yukicoder
*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
using namespace std;
/* constant */
const int MAX_N = 160000;
const int pns[8] = { 1, 4, 6, 12, 4, 12, 12, 24 };
/* typedef */
/* global variables */
int ss[MAX_N + 1];
/* subroutines */
/* main */
int main() {
int n, m;
scanf("%d%d", &n, &m);
for (int a = 0; a <= m; a++) {
int sa = a * a;
if (sa > n) break;
for (int b = a; b <= m; b++) {
int sb = sa + (a + b) * b;
if (sb > n) break;
for (int c = b; c <= m; c++) {
int sc = sb + (a + b + c) * c;
if (sc > n) break;
for (int d = c; d <= m; d++) {
int sd = sc + (a + b + c + d) * d;
if (sd > n) break;
int bits = 0;
if (a < b) bits |= 1;
if (b < c) bits |= 2;
if (c < d) bits |= 4;
ss[sd] += pns[bits];
}
}
}
}
for (int i = 0; i <= n; i++) printf("%d\n", ss[i]);
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0