結果

問題 No.1532 Different Products
ユーザー tailstails
提出日時 2021-06-11 18:01:39
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 416 ms / 4,000 ms
コード長 842 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 32,100 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-21 05:37:10
合計ジャッジ時間 17,574 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,376 KB
testcase_01 AC 65 ms
4,376 KB
testcase_02 AC 0 ms
4,376 KB
testcase_03 AC 0 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 0 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 4 ms
4,376 KB
testcase_09 AC 33 ms
4,380 KB
testcase_10 AC 94 ms
4,376 KB
testcase_11 AC 72 ms
4,376 KB
testcase_12 AC 203 ms
4,376 KB
testcase_13 AC 141 ms
4,380 KB
testcase_14 AC 340 ms
4,376 KB
testcase_15 AC 32 ms
4,380 KB
testcase_16 AC 75 ms
4,376 KB
testcase_17 AC 84 ms
4,376 KB
testcase_18 AC 74 ms
4,380 KB
testcase_19 AC 196 ms
4,380 KB
testcase_20 AC 343 ms
4,376 KB
testcase_21 AC 109 ms
4,376 KB
testcase_22 AC 133 ms
4,376 KB
testcase_23 AC 98 ms
4,376 KB
testcase_24 AC 317 ms
4,376 KB
testcase_25 AC 174 ms
4,380 KB
testcase_26 AC 24 ms
4,380 KB
testcase_27 AC 149 ms
4,380 KB
testcase_28 AC 116 ms
4,380 KB
testcase_29 AC 89 ms
4,380 KB
testcase_30 AC 199 ms
4,376 KB
testcase_31 AC 204 ms
4,376 KB
testcase_32 AC 236 ms
4,376 KB
testcase_33 AC 182 ms
4,376 KB
testcase_34 AC 300 ms
4,380 KB
testcase_35 AC 236 ms
4,376 KB
testcase_36 AC 288 ms
4,380 KB
testcase_37 AC 46 ms
4,376 KB
testcase_38 AC 307 ms
4,380 KB
testcase_39 AC 273 ms
4,380 KB
testcase_40 AC 280 ms
4,380 KB
testcase_41 AC 402 ms
4,380 KB
testcase_42 AC 355 ms
4,376 KB
testcase_43 AC 373 ms
4,380 KB
testcase_44 AC 409 ms
4,380 KB
testcase_45 AC 409 ms
4,380 KB
testcase_46 AC 397 ms
4,380 KB
testcase_47 AC 414 ms
4,376 KB
testcase_48 AC 408 ms
4,380 KB
testcase_49 AC 411 ms
4,376 KB
testcase_50 AC 408 ms
4,380 KB
testcase_51 AC 412 ms
4,376 KB
testcase_52 AC 404 ms
4,376 KB
testcase_53 AC 413 ms
4,376 KB
testcase_54 AC 405 ms
4,376 KB
testcase_55 AC 409 ms
4,380 KB
testcase_56 AC 396 ms
4,376 KB
testcase_57 AC 400 ms
4,376 KB
testcase_58 AC 408 ms
4,380 KB
testcase_59 AC 385 ms
4,376 KB
testcase_60 AC 416 ms
4,380 KB
testcase_61 AC 0 ms
4,380 KB
testcase_62 AC 0 ms
4,380 KB
testcase_63 AC 411 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:12:1: 警告: 戻り値の型をデフォルトの ‘int’ にします [-Wimplicit-int]
   12 | main(){
      | ^~~~
main.c: 関数 ‘main’ 内:
main.c:14:9: 警告: implicit declaration of function ‘read’; did you mean ‘rd’? [-Wimplicit-function-declaration]
   14 |         read(0,buf,sizeof buf);
      |         ^~~~
      |         rd
main.c:19:24: 警告: 関数 ‘sqrt’ の暗黙的な宣言です [-Wimplicit-function-declaration]
   19 |         long l=k/(long)sqrt(k);
      |                        ^~~~
main.c:1:1: 備考: include ‘<math.h>’ or provide a declaration of ‘sqrt’
  +++ |+#include <math.h>
    1 | #pragma GCC optimize("Ofast")
main.c:19:24: 警告: 組み込み関数 ‘sqrt’ の互換性がない暗黙的な宣言です [-Wbuiltin-declaration-mismatch]
   19 |         long l=k/(long)sqrt(k);
      |                        ^~~~
main.c:19:24: 備考: include ‘<math.h>’ or provide a declaration of ‘sqrt’
main.c:52:9: 警告: 関数 ‘write’ の暗黙的な宣言です [-Wimplicit-function-declaration]
   52 |         write(1,wp,buf+sizeof buf-wp);
      |         ^~~~~
main.c:53:9: 警告: implicit declaration of function ‘_exit’; did you mean ‘_Exit’? [-Wimplicit-function-declaration]
   53 |         _exit(0);
      |         ^~~~~
      |         _Exit

ソースコード

diff #

#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")

#define rd(v) long v=0;{int _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;}
#define wt(v) {long _z=v;do*--wp=_z%10+48;while(_z/=10);}

#define min(a,b) (a<=b?a:b)
#define max(a,b) (a>=b?a:b)

long dp1[100002],dp2[100002];

main(){
	char buf[64];
	read(0,buf,sizeof buf);
	char*rp=buf;

	rd(n);
	rd(k);
	long l=k/(long)sqrt(k);

	dp1[1]=1;
	for(long i=n;i>=2;--i){
		{
			long e=min(k/l,i*k+i-1+1);
			for(long j=1;j<e;++j){
				dp2[j/i]+=dp2[j];
			}
		}
		{
			long j=min(l,k/i);
			long e=l/i;
			for(;j>e;--j){
				dp2[k/(j*i)]+=dp1[j];
			}
			for(;j>0;--j){
				dp1[j*i]+=dp1[j];
			}
		}
	}
	long res=0;
	{
		for(long j=1;j<k/l;++j){
			res+=dp2[j];
		}
		for(long j=l;j>0;--j){
			res+=dp1[j];
		}
	}

	char*wp=buf+sizeof buf;
	wt(res*2-1);
	write(1,wp,buf+sizeof buf-wp);
	_exit(0);
}
0