QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#521140#3837. The Matching System zhouhuanyiAC ✓4ms7760kbC++141.0kb2024-08-15 21:52:562024-08-15 21:52:56

Judging History

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

  • [2024-08-15 21:52:56]
  • 评测
  • 测评结果:AC
  • 用时:4ms
  • 内存:7760kb
  • [2024-08-15 21:52:56]
  • 提交

answer

#include<iostream>
#include<cstdio>
#define N 1001
#define mod 1000000007
using namespace std;
int read()
{
	char c=0;
	int sum=0;
	while (c<'0'||c>'9') c=getchar();
	while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
	return sum;
}
int MD(int x)
{
	return x>=mod?x-mod:x;
}
void Adder(int &x,int d)
{
	x=x+d>=mod?x+d-mod:x+d;
	return;
}
int n,res,dp[N+1][N+1];
int main()
{
	n=read();
	if (n==1)
	{
		puts("*");
		puts("0");
		puts("1");
	}
	else if (n==2)
	{
		puts("*0");
		puts("00");
		puts("3");
	}
	else
	{
		for (int i=1;i<=n;++i) printf(i==n-1?"0":"*");
		puts("");
		for (int i=1;i<=n;++i) printf(i==1?"0":"1");
		puts("");
		for (int i=2;i<=n+1;++i) dp[1][i]=1+(i==n+1);
		for (int i=2;i<=n-1;++i)
			for (int j=1;j<=n+1;++j)
				dp[i][j]=MD(MD(dp[i-1][j]+dp[i][j-1])+1);
		printf("%d\n",dp[n-1][n+1]);
	}
	for (int i=1;i<=n;++i) printf(i<=(n>>1)+1?"*":"0");
	puts("");
	for (int i=1;i<=n;++i) printf("0");
	puts("");
	for (int i=1;i<=n;++i) res+=((i+3)>>1);
	printf("%d\n",res);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3

output:

*0*
011
8
**0
000
7

result:

ok Accepted

Test #2:

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

input:

1

output:

*
0
1
*
0
2

result:

ok Accepted

Test #3:

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

input:

2

output:

*0
00
3
**
00
4

result:

ok Accepted

Test #4:

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

input:

4

output:

**0*
0111
31
***0
0000
10

result:

ok Accepted

Test #5:

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

input:

5

output:

***0*
01111
119
***00
00000
14

result:

ok Accepted

Test #6:

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

input:

6

output:

****0*
011111
456
****00
000000
18

result:

ok Accepted

Test #7:

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

input:

10

output:

********0*
0111111111
99892
******0000
0000000000
40

result:

ok Accepted

Test #8:

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

input:

20

output:

******************0*
01111111111111111111
31775330
***********000000000
00000000000000000000
130

result:

ok Accepted

Test #9:

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

input:

30

output:

****************************0*
011111111111111111111111111111
37652369
****************00000000000000
000000000000000000000000000000
270

result:

ok Accepted

Test #10:

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

input:

50

output:

************************************************0*
01111111111111111111111111111111111111111111111111
637736708
**************************000000000000000000000000
00000000000000000000000000000000000000000000000000
700

result:

ok Accepted

Test #11:

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

input:

100

output:

**************************************************************************************************0*
0111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
990322733
***************************************************0000000000000000000000000000000000000...

result:

ok Accepted

Test #12:

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

input:

200

output:

******************************************************************************************************************************************************************************************************0*
011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Accepted

Test #13:

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

input:

499

output:

************************************************************************************************************************************************************************************************************************************************************************************************************...

result:

ok Accepted

Test #14:

score: 0
Accepted
time: 3ms
memory: 7564kb

input:

888

output:

************************************************************************************************************************************************************************************************************************************************************************************************************...

result:

ok Accepted

Test #15:

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

input:

999

output:

************************************************************************************************************************************************************************************************************************************************************************************************************...

result:

ok Accepted

Test #16:

score: 0
Accepted
time: 4ms
memory: 7700kb

input:

1000

output:

************************************************************************************************************************************************************************************************************************************************************************************************************...

result:

ok Accepted