結果

問題 No.1318 ABCD quadruplets
ユーザー kotatsugamekotatsugame
提出日時 2020-12-17 02:01:23
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 157 ms / 2,000 ms
コード長 1,189 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 34,844 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 10:27:34
合計ジャッジ時間 3,264 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 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 1 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 61 ms
4,348 KB
testcase_15 AC 4 ms
4,348 KB
testcase_16 AC 76 ms
4,348 KB
testcase_17 AC 12 ms
4,348 KB
testcase_18 AC 52 ms
4,348 KB
testcase_19 AC 27 ms
4,348 KB
testcase_20 AC 4 ms
4,348 KB
testcase_21 AC 11 ms
4,348 KB
testcase_22 AC 16 ms
4,348 KB
testcase_23 AC 157 ms
4,348 KB
testcase_24 AC 143 ms
4,348 KB
testcase_25 AC 37 ms
4,348 KB
testcase_26 AC 25 ms
4,348 KB
testcase_27 AC 100 ms
4,348 KB
testcase_28 AC 41 ms
4,348 KB
testcase_29 AC 49 ms
4,348 KB
testcase_30 AC 156 ms
4,348 KB
testcase_31 AC 38 ms
4,348 KB
testcase_32 AC 157 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main()
      | ^~~~

ソースコード

diff #

#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#include<cstdio>
using namespace std;
int N,M;
int ans[160001];
main()
{
	scanf("%d%d",&N,&M);
	for(int a=0;a<=M;a++)
	{
		int x=a*a;
		int b=a,y=x+(a+b)*b;
		if(y>N)break;
		{
			int c=b,z=y+(a+b+c)*c;
			if(z>N)break;
			{
				int d=c,w=z+(a+b+c+d)*d;
				if(w>N)break;
				{
					ans[w]++;
				}
				for(int d=c+1,w;d<=M&&(w=z+(a+b+c+d)*d)<=N;d++)
				{
					ans[w]+=4;
				}
			}
			for(int c=b+1,z;c<=M&&(z=y+(a+b+c)*c)<=N;c++)
			{
				int d=c,w=z+(a+b+c+d)*d;
				if(w>N)break;
				{
					ans[w]+=6;
				}
				for(int d=c+1,w;d<=M&&(w=z+(a+b+c+d)*d)<=N;d++)
				{
					ans[w]+=12;
				}
			}
		}
		for(int b=a+1,y;b<=M&&(y=x+(a+b)*b)<=N;b++)
		{
			int c=b,z=y+(a+b+c)*c;
			if(z>N)break;
			{
				int d=c,w=z+(a+b+c+d)*d;
				if(w>N)break;
				{
					ans[w]+=4;
				}
				for(int d=c+1,w;d<=M&&(w=z+(a+b+c+d)*d)<=N;d++)
				{
					ans[w]+=12;
				}
			}
			for(int c=b+1,z;c<=M&&(z=y+(a+b+c)*c)<=N;c++)
			{
				int d=c,w=z+(a+b+c+d)*d;
				if(w>N)break;
				{
					ans[w]+=12;
				}
				for(int d=c+1,w;d<=M&&(w=z+(a+b+c+d)*d)<=N;d++)
				{
					ans[w]+=24;
				}
			}
		}
	}
	for(int i=0;i<=N;i++)printf("%d\n",ans[i]);
}
0