QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#484854#8651. Table TennisQwerty1232#4 504ms3872kbC++231.9kb2024-07-20 03:13:362024-07-20 03:13:36

Judging History

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

  • [2024-07-20 03:13:36]
  • 评测
  • 测评结果:4
  • 用时:504ms
  • 内存:3872kb
  • [2024-07-20 03:13:36]
  • 提交

answer

#include <bits/stdc++.h>

int count(int n, const std::vector<std::vector<bool>> &data) {
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            for (int k = j + 1; k < n; k++) {
                if (data[i][j] == data[j][k] && data[j][k] == data[k][i]) {
                    cnt++;
                }
            }
        }
    }
    return cnt;
}

std::mt19937 rnd;

void solve() {
    int n, m;
    std::cin >> n >> m;
    std::vector<std::vector<bool>> ans(n, std::vector<bool>(n));
    if (0 && m <= n - 2) {
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                ans[i][j] = (i == 0 && j == m + 1);
                ans[j][i] = !ans[i][j];
            }
        }
        std::cout << "Yes\n";
        for (int i = 1; i < n; i++) {
            for (int j = 0; j < i; j++) {
                std::cout << ans[i][j];
            }
            std::cout << std::endl;
        }
        return;
    }
    assert(n <= 7);
    int cnt = n * (n - 1) / 2;
    for (int t = 0; t < (1 << cnt); t++) {
        int x = t;
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                int b = x & 1;
                x >>= 1;
                ans[i][j] = b;
                ans[j][i] = !b;
            }
        }
        int ct = count(n, ans);
        if (ct == m) {
            std::cout << "Yes\n";
            for (int i = 1; i < n; i++) {
                for (int j = 0; j < i; j++) {
                    std::cout << ans[i][j];
                }
                std::cout << std::endl;
            }
            return;
        }
    }
    std::cout << "No\n";
}

int32_t main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int t;
    std::cin >> t;
    while (t--) {
        solve();
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Runtime Error

Test #1:

score: 0
Runtime Error

input:

97
3 0
4 0
5 0
6 0
7 0
8 0
9 0
10 0
11 0
12 0
13 0
14 0
15 0
16 0
17 0
18 0
19 0
20 0
21 0
22 0
23 0
24 0
25 0
26 0
27 0
28 0
29 0
30 0
31 0
32 0
33 0
34 0
35 0
36 0
37 0
38 0
39 0
40 0
41 0
42 0
43 0
44 0
45 0
46 0
47 0
48 0
49 0
50 0
51 0
52 0
53 0
54 0
55 0
56 0
57 0
58 0
59 0
60 0
61 0
62 0
63 0...

output:

Yes
1
11
Yes
1
11
111
Yes
1
11
111
1111
Yes
1
11
111
1111
11111
Yes
1
11
111
1111
11111
111111

result:


Subtask #2:

score: 4
Accepted

Test #58:

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

input:

1
4 4

output:

No

result:

ok good job! (1 test case)

Test #59:

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

input:

1
5 10

output:

No

result:

ok good job! (1 test case)

Test #60:

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

input:

1
6 20

output:

No

result:

ok good job! (1 test case)

Test #61:

score: 0
Accepted
time: 493ms
memory: 3852kb

input:

1
7 35

output:

No

result:

ok good job! (1 test case)

Test #62:

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

input:

1
5 10

output:

No

result:

ok good job! (1 test case)

Test #63:

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

input:

1
6 19

output:

No

result:

ok good job! (1 test case)

Test #64:

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

input:

1
6 20

output:

No

result:

ok good job! (1 test case)

Test #65:

score: 0
Accepted
time: 499ms
memory: 3556kb

input:

1
7 33

output:

No

result:

ok good job! (1 test case)

Test #66:

score: 0
Accepted
time: 504ms
memory: 3508kb

input:

1
7 33

output:

No

result:

ok good job! (1 test case)

Test #67:

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

input:

1
4 3

output:

No

result:

ok good job! (1 test case)

Test #68:

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

input:

1
5 8

output:

No

result:

ok good job! (1 test case)

Test #69:

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

input:

1
6 17

output:

No

result:

ok good job! (1 test case)

Test #70:

score: 0
Accepted
time: 495ms
memory: 3620kb

input:

1
7 30

output:

No

result:

ok good job! (1 test case)

Test #71:

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

input:

2
3 0
3 1

output:

Yes
1
11
Yes
1
01

result:

ok good job! (2 test cases)

Test #72:

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

input:

2
3 0
3 1

output:

Yes
1
11
Yes
1
01

result:

ok good job! (2 test cases)

Test #73:

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

input:

1
4 2

output:

Yes
1
11
011

result:

ok good job! (1 test case)

Test #74:

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

input:

1
5 5

output:

Yes
1
11
011
0011

result:

ok good job! (1 test case)

Test #75:

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

input:

1
6 8

output:

Yes
1
11
111
0111
00111

result:

ok good job! (1 test case)

Test #76:

score: 0
Accepted
time: 5ms
memory: 3560kb

input:

1
7 14

output:

Yes
1
11
111
0111
00111
000111

result:

ok good job! (1 test case)

Test #77:

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

input:

1
6 5

output:

Yes
1
11
011
1111
01111

result:

ok good job! (1 test case)

Test #78:

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

input:

1
6 4

output:

Yes
1
11
011
0111
11111

result:

ok good job! (1 test case)

Test #79:

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

input:

1
7 7

output:

Yes
1
11
111
0111
11111
011111

result:

ok good job! (1 test case)

Test #80:

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

input:

1
7 6

output:

Yes
1
11
111
0111
01111
111111

result:

ok good job! (1 test case)

Test #81:

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

input:

1
7 8

output:

Yes
1
11
111
1111
01111
011111

result:

ok good job! (1 test case)

Test #82:

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

input:

1
6 7

output:

Yes
1
11
101
0111
01111

result:

ok good job! (1 test case)

Test #83:

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

input:

1
6 6

output:

Yes
1
11
111
0111
01111

result:

ok good job! (1 test case)

Test #84:

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

input:

1
7 11

output:

Yes
1
11
111
0111
00111
011111

result:

ok good job! (1 test case)

Test #85:

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

input:

1
7 11

output:

Yes
1
11
111
0111
00111
011111

result:

ok good job! (1 test case)

Test #86:

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

input:

1
7 13

output:

Yes
1
11
111
0111
00111
001111

result:

ok good job! (1 test case)

Test #87:

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

input:

1
6 6

output:

Yes
1
11
111
0111
01111

result:

ok good job! (1 test case)

Test #88:

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

input:

1
7 9

output:

Yes
1
11
111
0111
01111
011111

result:

ok good job! (1 test case)

Test #89:

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

input:

1
4 3

output:

No

result:

ok good job! (1 test case)

Test #90:

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

input:

1
5 10

output:

No

result:

ok good job! (1 test case)

Test #91:

score: 0
Accepted
time: 6ms
memory: 3560kb

input:

1
6 13

output:

No

result:

ok good job! (1 test case)

Test #92:

score: 0
Accepted
time: 495ms
memory: 3656kb

input:

1
7 23

output:

No

result:

ok good job! (1 test case)

Test #93:

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

input:

1
6 5

output:

Yes
1
11
011
1111
01111

result:

ok good job! (1 test case)

Test #94:

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

input:

1
6 2

output:

Yes
1
11
011
1111
11111

result:

ok good job! (1 test case)

Test #95:

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

input:

1
7 7

output:

Yes
1
11
111
0111
11111
011111

result:

ok good job! (1 test case)

Test #96:

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

input:

1
7 6

output:

Yes
1
11
111
0111
01111
111111

result:

ok good job! (1 test case)

Test #97:

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

input:

1
7 8

output:

Yes
1
11
111
1111
01111
011111

result:

ok good job! (1 test case)

Test #98:

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

input:

1
6 5

output:

Yes
1
11
011
1111
01111

result:

ok good job! (1 test case)

Test #99:

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

input:

1
6 4

output:

Yes
1
11
011
0111
11111

result:

ok good job! (1 test case)

Test #100:

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

input:

1
7 7

output:

Yes
1
11
111
0111
11111
011111

result:

ok good job! (1 test case)

Test #101:

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

input:

1
7 6

output:

Yes
1
11
111
0111
01111
111111

result:

ok good job! (1 test case)

Test #102:

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

input:

1
7 8

output:

Yes
1
11
111
1111
01111
011111

result:

ok good job! (1 test case)

Test #103:

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

input:

1
6 1

output:

Yes
1
01
111
1111
11111

result:

ok good job! (1 test case)

Test #104:

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

input:

1
6 1

output:

Yes
1
01
111
1111
11111

result:

ok good job! (1 test case)

Test #105:

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

input:

1
7 3

output:

Yes
1
11
111
0111
11111
111111

result:

ok good job! (1 test case)

Test #106:

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

input:

1
7 3

output:

Yes
1
11
111
0111
11111
111111

result:

ok good job! (1 test case)

Test #107:

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

input:

1
7 3

output:

Yes
1
11
111
0111
11111
111111

result:

ok good job! (1 test case)

Test #108:

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

input:

1
5 2

output:

Yes
1
11
011
1111

result:

ok good job! (1 test case)

Test #109:

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

input:

1
6 5

output:

Yes
1
11
011
1111
01111

result:

ok good job! (1 test case)

Test #110:

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

input:

2
4 1
3 0

output:

Yes
1
01
111
Yes
1
11

result:

ok good job! (2 test cases)

Test #111:

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

input:

1
6 1

output:

Yes
1
01
111
1111
11111

result:

ok good job! (1 test case)

Test #112:

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

input:

2
3 0
3 1

output:

Yes
1
11
Yes
1
01

result:

ok good job! (2 test cases)

Test #113:

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

input:

1
6 1

output:

Yes
1
01
111
1111
11111

result:

ok good job! (1 test case)

Test #114:

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

input:

1
6 4

output:

Yes
1
11
011
0111
11111

result:

ok good job! (1 test case)

Test #115:

score: 0
Accepted
time: 5ms
memory: 3872kb

input:

1
7 14

output:

Yes
1
11
111
0111
00111
000111

result:

ok good job! (1 test case)

Test #116:

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

input:

1
7 8

output:

Yes
1
11
111
1111
01111
011111

result:

ok good job! (1 test case)

Test #117:

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

input:

1
7 10

output:

Yes
1
11
101
0111
01111
011111

result:

ok good job! (1 test case)

Subtask #3:

score: 0
Runtime Error

Dependency #2:

100%
Accepted

Test #118:

score: 0
Runtime Error

input:

1
19 969

output:


result:


Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #4:

0%

Subtask #6:

score: 0
Skipped

Dependency #1:

0%