結果

問題 No.1318 ABCD quadruplets
ユーザー 👑 NachiaNachia
提出日時 2020-12-22 20:31:59
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 394 ms / 2,000 ms
コード長 740 bytes
コンパイル時間 2,020 ms
コンパイル使用メモリ 202,232 KB
実行使用メモリ 4,876 KB
最終ジャッジ日時 2023-10-21 13:03:37
合計ジャッジ時間 8,103 ms
ジャッジサーバーID
(参考情報)
judge11 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 3 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 24 ms
4,348 KB
testcase_14 AC 229 ms
4,688 KB
testcase_15 AC 23 ms
4,348 KB
testcase_16 AC 212 ms
4,492 KB
testcase_17 AC 139 ms
4,348 KB
testcase_18 AC 208 ms
4,584 KB
testcase_19 AC 201 ms
4,732 KB
testcase_20 AC 21 ms
4,348 KB
testcase_21 AC 52 ms
4,348 KB
testcase_22 AC 208 ms
4,348 KB
testcase_23 AC 353 ms
4,876 KB
testcase_24 AC 343 ms
4,876 KB
testcase_25 AC 230 ms
4,876 KB
testcase_26 AC 216 ms
4,572 KB
testcase_27 AC 308 ms
4,876 KB
testcase_28 AC 267 ms
4,876 KB
testcase_29 AC 246 ms
4,876 KB
testcase_30 AC 354 ms
4,876 KB
testcase_31 AC 234 ms
4,876 KB
testcase_32 AC 394 ms
4,876 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

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

int main(){
	int 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) cout<<A[i]<<endl;

	return 0;
}
0