QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#697381#3837. The Matching System yzj123#AC ✓14ms35116kbC++201.7kb2024-11-01 13:41:352024-11-01 13:41:35

Judging History

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

  • [2024-11-01 13:41:35]
  • 评测
  • 测评结果:AC
  • 用时:14ms
  • 内存:35116kb
  • [2024-11-01 13:41:35]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long

ll mod = 1e9 + 7;
ll C[2010][2010];
int main()
{
    ll n; cin >> n;
    ll k = 0; if (n % 2 == 1)k = 1;
    else k = 2;
    ll temp = n + 1;
    ll ans = 0;
    if (n == 1)
    {
        cout << 1 << endl;
        cout << 1 << endl;
        cout << 1 << endl;
        cout << "*" << endl;
        cout << 1 << endl;
        cout << 2 << endl;
        return 0;
    }
    if (n == 2)
    {
        cout << "*1" << endl;
        cout << "01" << endl;
        cout << 3 << endl;
        cout << "*1" << endl;
        cout << "01" << endl;
        cout << 4 << endl;
        return 0;
    }
    C[0][0] = 1;
    for (int i = 1; i <= 2000; i++)
    {
        C[i][0] = 1;
        for (int j = 1; j <= 2000; j++)
            C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % mod;
    }
    for (int i = 1; i <= temp - 3; ++i)
    {
        ans = (ans + C[temp + i - 1][i]) % mod;
        //cout << "test" << ans << endl;
    }
    //cout << C[temp + temp - 4][temp - 3]- C[temp + temp - 5][temp - 4] << endl;
    ans = ans + C[temp + temp - 4][temp - 3] - C[temp + temp - 5][temp - 4] + 1;
    ans = (ans+mod) % mod;
    for (int i = 1; i <= n - 2; ++i)cout << '*';
    cout << 0 << '*' << endl;
    cout << 0;
    for (int i = 2; i <= n; ++i)cout << 1;
    cout << endl;
    cout << ans << endl;

    //2
    ll m = (n - k) / 2;
    ans = (m + k + 1) * m % mod + m + m + k + k;
    ans = ans % mod;
    for (int i = 1; i <= m + k; ++i)cout << '*';
    for (int i = 1; i <= m; ++i)cout << 1;
    cout << endl;
    for (int i = 1; i <= n; ++i)cout << 1;
    cout << endl;
    cout << ans << endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 7ms
memory: 35048kb

input:

3

output:

*0*
011
8
**1
111
7

result:

ok Accepted

Test #2:

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

input:

1

output:

1
1
1
*
1
2

result:

ok Accepted

Test #3:

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

input:

2

output:

*1
01
3
*1
01
4

result:

ok Accepted

Test #4:

score: 0
Accepted
time: 14ms
memory: 34976kb

input:

4

output:

**0*
0111
31
***1
1111
10

result:

ok Accepted

Test #5:

score: 0
Accepted
time: 10ms
memory: 35100kb

input:

5

output:

***0*
01111
119
***11
11111
14

result:

ok Accepted

Test #6:

score: 0
Accepted
time: 10ms
memory: 34972kb

input:

6

output:

****0*
011111
456
****11
111111
18

result:

ok Accepted

Test #7:

score: 0
Accepted
time: 13ms
memory: 35024kb

input:

10

output:

********0*
0111111111
99892
******1111
1111111111
40

result:

ok Accepted

Test #8:

score: 0
Accepted
time: 10ms
memory: 35040kb

input:

20

output:

******************0*
01111111111111111111
31775330
***********111111111
11111111111111111111
130

result:

ok Accepted

Test #9:

score: 0
Accepted
time: 13ms
memory: 34976kb

input:

30

output:

****************************0*
011111111111111111111111111111
37652369
****************11111111111111
111111111111111111111111111111
270

result:

ok Accepted

Test #10:

score: 0
Accepted
time: 10ms
memory: 35040kb

input:

50

output:

************************************************0*
01111111111111111111111111111111111111111111111111
637736708
**************************111111111111111111111111
11111111111111111111111111111111111111111111111111
700

result:

ok Accepted

Test #11:

score: 0
Accepted
time: 13ms
memory: 34984kb

input:

100

output:

**************************************************************************************************0*
0111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
990322733
***************************************************1111111111111111111111111111111111111...

result:

ok Accepted

Test #12:

score: 0
Accepted
time: 13ms
memory: 34968kb

input:

200

output:

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

result:

ok Accepted

Test #13:

score: 0
Accepted
time: 14ms
memory: 35040kb

input:

499

output:

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

result:

ok Accepted

Test #14:

score: 0
Accepted
time: 8ms
memory: 35116kb

input:

888

output:

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

result:

ok Accepted

Test #15:

score: 0
Accepted
time: 7ms
memory: 35036kb

input:

999

output:

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

result:

ok Accepted

Test #16:

score: 0
Accepted
time: 13ms
memory: 35052kb

input:

1000

output:

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

result:

ok Accepted