結果

問題 No.1318 ABCD quadruplets
ユーザー furafura
提出日時 2020-12-15 20:01:49
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 722 ms / 2,000 ms
コード長 619 bytes
コンパイル時間 2,158 ms
コンパイル使用メモリ 202,768 KB
実行使用メモリ 168,504 KB
最終ジャッジ日時 2023-10-20 06:28:34
合計ジャッジ時間 9,276 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,912 KB
testcase_01 AC 3 ms
7,912 KB
testcase_02 AC 3 ms
7,912 KB
testcase_03 AC 3 ms
5,864 KB
testcase_04 AC 3 ms
7,912 KB
testcase_05 AC 3 ms
5,864 KB
testcase_06 AC 3 ms
7,912 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 3 ms
5,864 KB
testcase_09 AC 4 ms
9,960 KB
testcase_10 AC 4 ms
12,012 KB
testcase_11 AC 4 ms
9,964 KB
testcase_12 AC 3 ms
5,864 KB
testcase_13 AC 36 ms
98,112 KB
testcase_14 AC 267 ms
121,480 KB
testcase_15 AC 28 ms
89,900 KB
testcase_16 AC 354 ms
132,640 KB
testcase_17 AC 66 ms
112,464 KB
testcase_18 AC 247 ms
137,860 KB
testcase_19 AC 150 ms
137,084 KB
testcase_20 AC 34 ms
98,084 KB
testcase_21 AC 69 ms
135,112 KB
testcase_22 AC 75 ms
81,928 KB
testcase_23 AC 722 ms
168,504 KB
testcase_24 AC 609 ms
157,632 KB
testcase_25 AC 189 ms
136,416 KB
testcase_26 AC 138 ms
134,388 KB
testcase_27 AC 424 ms
147,632 KB
testcase_28 AC 206 ms
137,132 KB
testcase_29 AC 237 ms
138,400 KB
testcase_30 AC 653 ms
167,804 KB
testcase_31 AC 198 ms
136,708 KB
testcase_32 AC 654 ms
167,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int n,m; scanf("%d%d",&n,&m);

	static int g[490][160001]; // g[i][j] = (a+b+c=i, a^2+ab+ac+b^2+bc+c^2=j となる (a,b,c) の個数)
	rep(a,m+1){
		int x=a*a;
		if(x>n) break;
		rep(b,m+1){
			int y=(a+b)*b;
			if(x+y>n) break;
			rep(c,m+1){
				int z=(a+b+c)*c;
				if(x+y+z>n) break;
				g[a+b+c][x+y+z]++;

			}
		}
	}

	vector<int> ans(n+1);
	rep(i,490) rep(j,n+1) if(g[i][j]>0) {
		rep(d,m+1){
			int w=(i+d)*d;
			if(j+w>n) break;
			ans[j+w]+=g[i][j];
		}
	}
	rep(i,n+1) printf("%d\n",ans[i]);

	return 0;
}
0