結果

問題 No.1318 ABCD quadruplets
ユーザー 👑 NachiaNachia
提出日時 2020-12-22 20:35:05
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 142 ms / 2,000 ms
コード長 764 bytes
コンパイル時間 2,456 ms
コンパイル使用メモリ 201,888 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-10-21 13:03:43
合計ジャッジ時間 5,473 ms
ジャッジサーバーID
(参考情報)
judge10 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 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 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 5 ms
4,348 KB
testcase_14 AC 58 ms
4,348 KB
testcase_15 AC 4 ms
4,348 KB
testcase_16 AC 72 ms
4,348 KB
testcase_17 AC 12 ms
4,348 KB
testcase_18 AC 53 ms
4,348 KB
testcase_19 AC 26 ms
4,348 KB
testcase_20 AC 4 ms
4,348 KB
testcase_21 AC 11 ms
4,348 KB
testcase_22 AC 15 ms
4,348 KB
testcase_23 AC 142 ms
4,380 KB
testcase_24 AC 131 ms
4,380 KB
testcase_25 AC 36 ms
4,380 KB
testcase_26 AC 24 ms
4,348 KB
testcase_27 AC 97 ms
4,380 KB
testcase_28 AC 40 ms
4,380 KB
testcase_29 AC 47 ms
4,380 KB
testcase_30 AC 141 ms
4,380 KB
testcase_31 AC 38 ms
4,380 KB
testcase_32 AC 141 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

inline UL F(UL a,UL b,UL c,UL d){  int x=a*a; a+=b; x+=a*b; a+=c; x+=a*c; a+=d; x+=a*d; return x; }

UL A[262144]={}; UL fx;
#define adA(x) fx=x; if(fx<=N) A[fx]

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

	return 0;
}
0