QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#60330 | #1085. Brave Seekers of Unicorns | lgvc | TL | 66ms | 5804kb | C++ | 1.5kb | 2022-11-03 17:25:47 | 2022-11-03 17:25:49 |
Judging History
answer
#include <bits/stdc++.h>
//#define int long long
#define pai 3.141592653589793238462643383279502884197169399375105820
#define MOD 998244353
#define eps 0.00000001
inline int min(int a,int b) {return a<b?a:b;}
inline int max(int a,int b) {return a>b?a:b;}
#define ULL unsigned long long
#define LL long long
#define INF 0x3f3f3f3f
#define INF_LL 0x3f3f3f3f3f3f3f3f
static char buf[1000000],*paa=buf,*pd=buf;
static char buf2[1000000],*pp=buf2;
#define getchar() paa==pd&&(pd=(paa=buf)+fread(buf,1,1000000,stdin),paa==pd)?EOF:*paa++
inline void pc(char ch){
if(pp-buf2==1000000) fwrite(buf2,1,1000000,stdout),pp=buf2;
*pp++=ch;
}
inline void pcc(){
fwrite(buf2,1,pp-buf2,stdout);
pp=buf2;
}
inline int read(void) {
int w=1;
register int x(0);register char c(getchar());
while(c<'0'||c>'9') {if(c=='-') w=-1;c=getchar();}
while(c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();
return w*x;
}
void write(int x) {
static int sta[20];
int top=0;
do {
sta[top++]=x%10,x/=10;
} while(x);
while(top) pc(sta[--top]+48);
}
void we(int x) {
write(x);
pc('\n');
}
inline bool cmp_xi(int a,int b) {return a<b;}
inline bool cmp_da(int a,int b) {return a>b;}
int N,ans,cnt,f[1000009];
signed main(void) {
//freopen("m.in","r",stdin);
//freopen("m.out","w",stdout);
N=read();
for(int i=1;i<=N;i++) {
cnt+=f[i-1];
cnt%=MOD;
f[i]=(cnt+1)%MOD;
for(int j=1;j<i;j++) {
if((j^i)<j) f[i]=(f[i]-f[j^i]+MOD)%MOD;
}
ans=(ans+f[i])%MOD;
}
printf("%d",ans);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 5704kb
input:
1
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 2ms
memory: 3436kb
input:
2
output:
3
result:
ok 1 number(s): "3"
Test #3:
score: 0
Accepted
time: 0ms
memory: 5804kb
input:
3
output:
6
result:
ok 1 number(s): "6"
Test #4:
score: 0
Accepted
time: 2ms
memory: 3468kb
input:
5
output:
26
result:
ok 1 number(s): "26"
Test #5:
score: 0
Accepted
time: 2ms
memory: 3700kb
input:
322
output:
782852421
result:
ok 1 number(s): "782852421"
Test #6:
score: 0
Accepted
time: 2ms
memory: 5588kb
input:
10
output:
728
result:
ok 1 number(s): "728"
Test #7:
score: 0
Accepted
time: 2ms
memory: 3508kb
input:
100
output:
234222727
result:
ok 1 number(s): "234222727"
Test #8:
score: 0
Accepted
time: 66ms
memory: 5736kb
input:
10000
output:
348787098
result:
ok 1 number(s): "348787098"
Test #9:
score: -100
Time Limit Exceeded
input:
1000000