QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#389406#1085. Brave Seekers of UnicornsSroundWA 24ms136004kbC++141.1kb2024-04-14 11:33:022024-04-14 11:33:02

Judging History

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

  • [2024-04-14 11:33:02]
  • 评测
  • 测评结果:WA
  • 用时:24ms
  • 内存:136004kb
  • [2024-04-14 11:33:02]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

inline int read()
{
	int x=0;bool f=0;char ch=getchar();
	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 f?-x:x;
}

#define x first
#define y second
#define pb push_back
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)

typedef pair<int,int> PII;
typedef long long LL;
typedef unsigned long long ull;
const int N=510;

int n,MOD;
int f[N][N][N];
int sum[N][N];

void solve1()
{
	rep(i,1,n) f[1][i][0]=sum[1][i]=1;
	rep(i,2,n) {
		sum[2][i]=i-1;
		rep(j,1,i-1) f[2][i][j]=1;
	}
	rep(i,3,n) rep(j,i,n) rep(k,i-1,j-1) {
		f[i][j][k]=((sum[i-1][k]-(((j^k)<k)?f[i-1][k][j^k]:0))%MOD+MOD)%MOD;
		(sum[i][j]+=f[i][j][k])%=MOD;
	}
	
	int ans=0;
	// cout<<sum[3][3]<<endl;
	rep(i,1,n) rep(j,i,n) ans=(ans+sum[i][j])%MOD;
	printf("%d\n",ans);
}

void solve2()
{
	
}

int main()
{
	n=read(),MOD=998244353;
	if(n==1) puts("1");
	else if(n<=500) solve1();
	else if(n<=5000) solve2();
	else puts("0");
	
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3536kb

input:

1

output:

1

result:

ok 1 number(s): "1"

Test #2:

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

input:

2

output:

3

result:

ok 1 number(s): "3"

Test #3:

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

input:

3

output:

6

result:

ok 1 number(s): "6"

Test #4:

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

input:

5

output:

26

result:

ok 1 number(s): "26"

Test #5:

score: 0
Accepted
time: 24ms
memory: 136004kb

input:

322

output:

782852421

result:

ok 1 number(s): "782852421"

Test #6:

score: 0
Accepted
time: 2ms
memory: 14168kb

input:

10

output:

728

result:

ok 1 number(s): "728"

Test #7:

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

input:

100

output:

234222727

result:

ok 1 number(s): "234222727"

Test #8:

score: -100
Wrong Answer
time: 0ms
memory: 3728kb

input:

10000

output:

0

result:

wrong answer 1st numbers differ - expected: '348787098', found: '0'