結果

問題 No.1318 ABCD quadruplets
ユーザー 👑 NachiaNachia
提出日時 2020-12-22 20:46:25
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 613 bytes
コンパイル時間 1,976 ms
コンパイル使用メモリ 202,180 KB
実行使用メモリ 4,436 KB
最終ジャッジ日時 2023-10-21 13:03:53
合計ジャッジ時間 3,841 ms
ジャッジサーバーID
(参考情報)
judge13 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using UL=unsigned int;
#define rep(i,n) for(UL i=0; i<(n); i++)

UL A[262144]={}; UL fx;
#define F(a,b,c,d) a*a+(b+c+d)*(a+b)+c*c+d*(c+d)
#define adA(a,b,c,d,x) fx=F(a,b,c,d); if(fx<=N) A[fx]+=x;

int main(){
	UL N,M; scanf("%u%u",&N,&M);
	rep(a,M+1){
		if(F(a,0,0,0)>N) break;
		adA(a,a,a,a,1)
		rep(b,a){
			if(F(a,b,0,0)>N) break;
			adA(a,b,b,b,4)
			adA(a,a,b,b,6)
			adA(a,a,a,b,4)
			rep(c,b){
				if(F(a,b,c,0)>N) break;
				adA(a,b,c,c,12)
				adA(a,b,b,c,12)
				adA(a,a,b,c,12)
				rep(d,c) adA(a,b,c,d,24) else break;
			}
		}
	}
	rep(i,N+1) printf("%u\n",A[i]);

	return 0;
}
0