QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#762464#8023. The Journey of Geor Autumnmsk_samaAC ✓172ms235924kbC++141.3kb2024-11-19 15:05:172024-11-19 15:05:18

Judging History

你现在查看的是最新测评结果

  • [2024-11-19 15:05:18]
  • 评测
  • 测评结果:AC
  • 用时:172ms
  • 内存:235924kb
  • [2024-11-19 15:05:17]
  • 提交

answer

#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <ctime>
#include <cstdio>
#include <random>
#include <vector>
#include <bitset>
#include <cassert>
#include <cstring>
#include <algorithm>
#define fi first
#define se second
#define MISAKA main
#define ll long long
#define eb emplace_back
#define pii pair<int,int>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define _rep(i,a,b) for(int i=(a);i>=(b);--i)
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define FIO(FILE) freopen(FILE".in","r",stdin),freopen(FILE".out","w",stdout)
using namespace std;
inline int read(){
    char ch=getchar();int f=1,x=0;
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
    return x*f;
}
const int N=1e7+10,mod=998244353;
int n,k;ll f[N],g[N],fac=1,inv[N];
ll qp(ll a,ll b){ll r=1;for(;b;b>>=1,a=a*a%mod)if(b&1)r=r*a%mod;return r;}
void misaka(){
    n=read(),k=read();
    f[0]=inv[1]=1;
    rep(i,2,n) (fac*=i)%=mod,inv[i]=inv[mod%i]*(mod-mod/i)%mod;
    g[0]=inv[n];
    rep(i,1,n){
        f[i]=(g[i-1]-(i-k>0?g[i-k-1]:0)+mod)%mod;
        g[i]=(g[i-1]+f[i]*inv[n-i])%mod;
    }
    printf("%lld",fac*f[n]%mod);
}
signed MISAKA(){
    // FIO("b");
    int T=1;
    while(T--) misaka();
    return 0;
}

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 5656kb

input:

1 1

output:

1

result:

ok "1"

Test #2:

score: 0
Accepted
time: 0ms
memory: 5684kb

input:

1 2

output:

1

result:

ok "1"

Test #3:

score: 0
Accepted
time: 0ms
memory: 5604kb

input:

1 3

output:

1

result:

ok "1"

Test #4:

score: 0
Accepted
time: 0ms
memory: 5688kb

input:

1 4

output:

1

result:

ok "1"

Test #5:

score: 0
Accepted
time: 0ms
memory: 5620kb

input:

2 1

output:

1

result:

ok "1"

Test #6:

score: 0
Accepted
time: 0ms
memory: 5608kb

input:

2 2

output:

2

result:

ok "2"

Test #7:

score: 0
Accepted
time: 0ms
memory: 5620kb

input:

2 3

output:

2

result:

ok "2"

Test #8:

score: 0
Accepted
time: 0ms
memory: 5596kb

input:

2 4

output:

2

result:

ok "2"

Test #9:

score: 0
Accepted
time: 0ms
memory: 5632kb

input:

3 1

output:

1

result:

ok "1"

Test #10:

score: 0
Accepted
time: 0ms
memory: 5652kb

input:

3 2

output:

4

result:

ok "4"

Test #11:

score: 0
Accepted
time: 0ms
memory: 5600kb

input:

3 3

output:

6

result:

ok "6"

Test #12:

score: 0
Accepted
time: 0ms
memory: 5688kb

input:

3 4

output:

6

result:

ok "6"

Test #13:

score: 0
Accepted
time: 0ms
memory: 5516kb

input:

4 1

output:

1

result:

ok "1"

Test #14:

score: 0
Accepted
time: 1ms
memory: 5508kb

input:

4 2

output:

10

result:

ok "10"

Test #15:

score: 0
Accepted
time: 0ms
memory: 5588kb

input:

4 3

output:

18

result:

ok "18"

Test #16:

score: 0
Accepted
time: 0ms
memory: 5608kb

input:

4 4

output:

24

result:

ok "24"

Test #17:

score: 0
Accepted
time: 0ms
memory: 5508kb

input:

99 50

output:

955866606

result:

ok "955866606"

Test #18:

score: 0
Accepted
time: 0ms
memory: 5616kb

input:

99 70

output:

296999003

result:

ok "296999003"

Test #19:

score: 0
Accepted
time: 0ms
memory: 5664kb

input:

1034 998

output:

637688669

result:

ok "637688669"

Test #20:

score: 0
Accepted
time: 0ms
memory: 5608kb

input:

1099 997

output:

712935289

result:

ok "712935289"

Test #21:

score: 0
Accepted
time: 1ms
memory: 5732kb

input:

10314 998

output:

224695890

result:

ok "224695890"

Test #22:

score: 0
Accepted
time: 1ms
memory: 5692kb

input:

10929 9974

output:

160291286

result:

ok "160291286"

Test #23:

score: 0
Accepted
time: 0ms
memory: 12360kb

input:

103124 99448

output:

695932649

result:

ok "695932649"

Test #24:

score: 0
Accepted
time: 0ms
memory: 12364kb

input:

109139 9937

output:

268916696

result:

ok "268916696"

Test #25:

score: 0
Accepted
time: 12ms
memory: 30248kb

input:

1031234 99238

output:

441457721

result:

ok "441457721"

Test #26:

score: 0
Accepted
time: 19ms
memory: 31252kb

input:

1091239 991237

output:

61047495

result:

ok "61047495"

Test #27:

score: 0
Accepted
time: 145ms
memory: 235876kb

input:

10000000 9982443

output:

224744113

result:

ok "224744113"

Test #28:

score: 0
Accepted
time: 172ms
memory: 235924kb

input:

9999977 5678901

output:

641748125

result:

ok "641748125"

Extra Test:

score: 0
Extra Test Passed