結果
| 問題 | No.1532 Different Products |
| コンテスト | |
| ユーザー |
👑 tails
|
| 提出日時 | 2021-06-11 18:01:39 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 414 ms / 4,000 ms |
| コード長 | 842 bytes |
| コンパイル時間 | 425 ms |
| コンパイル使用メモリ | 33,408 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-14 14:32:46 |
| 合計ジャッジ時間 | 16,259 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 62 |
コンパイルメッセージ
main.c:12:1: warning: return type defaults to 'int' [-Wimplicit-int]
12 | main(){
| ^~~~
main.c: In function 'main':
main.c:14:9: warning: implicit declaration of function 'read'; did you mean 'rd'? [-Wimplicit-function-declaration]
14 | read(0,buf,sizeof buf);
| ^~~~
| rd
main.c:19:24: warning: implicit declaration of function 'sqrt' [-Wimplicit-function-declaration]
19 | long l=k/(long)sqrt(k);
| ^~~~
main.c:1:1: note: include '<math.h>' or provide a declaration of 'sqrt'
+++ |+#include <math.h>
1 | #pragma GCC optimize("Ofast")
main.c:19:24: warning: incompatible implicit declaration of built-in function 'sqrt' [-Wbuiltin-declaration-mismatch]
19 | long l=k/(long)sqrt(k);
| ^~~~
main.c:19:24: note: include '<math.h>' or provide a declaration of 'sqrt'
main.c:52:9: warning: implicit declaration of function 'write' [-Wimplicit-function-declaration]
52 | write(1,wp,buf+sizeof buf-wp);
| ^~~~~
main.c:53:9: warning: implicit declaration of function '_exit'; did you mean '_Exit'? [-Wimplicit-function-declaration]
53 | _exit(0);
| ^~~~~
| _Exit
ソースコード
#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);
}
tails