QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#483191 | #6740. Function | ucup-team052# | TL | 77ms | 3712kb | C++14 | 678b | 2024-07-18 13:11:41 | 2024-07-18 13:11:42 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
inline int add(int x,int y) {return x+y>=mod?x+y-mod:x+y;}
inline int sub(int x,int y) {return x-y<0?x-y+mod:x-y;}
inline int mul(int x,int y) {return 1ULL*x*y%mod;}
int n;
#define N 100005
const int L=20210926;
int pos[N],w[N],m;
int main() {
cin>>n;
for(int l=1,r;l<=n;l=r+1)
{
r=n/(n/l);
// printf("%d %d\n",l,r);
pos[++m]=l;
}
for(int i=m;i>=1;i--)
{
w[i]=1;
for(int j=2;j<=L&&1LL*pos[i]*j<=n;j++)
{
int gid=upper_bound(pos+1,pos+m+1,pos[i]*j)-pos-1;
// printf("%d %d\n",pos[i]*j,gid);
w[i]=add(w[i],w[gid]);
}
}
cout<<w[1]<<endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3712kb
input:
1
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
2
output:
2
result:
ok 1 number(s): "2"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
100
output:
949
result:
ok 1 number(s): "949"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
10
output:
19
result:
ok 1 number(s): "19"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
1000
output:
48614
result:
ok 1 number(s): "48614"
Test #6:
score: 0
Accepted
time: 1ms
memory: 3600kb
input:
10000
output:
2602393
result:
ok 1 number(s): "2602393"
Test #7:
score: 0
Accepted
time: 3ms
memory: 3636kb
input:
100000
output:
139804054
result:
ok 1 number(s): "139804054"
Test #8:
score: 0
Accepted
time: 77ms
memory: 3552kb
input:
1000000
output:
521718285
result:
ok 1 number(s): "521718285"
Test #9:
score: -100
Time Limit Exceeded
input:
10000000
output:
503104917