QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#484853#8651. Table TennisQwerty1232#0 487ms3824kbC++232.0kb2024-07-20 03:11:542024-07-20 03:11:54

Judging History

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

  • [2024-07-20 03:11:54]
  • 评测
  • 测评结果:0
  • 用时:487ms
  • 内存:3824kb
  • [2024-07-20 03:11:54]
  • 提交

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));
    // clock_t beg = clock();
    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::cerr << count(n, ans) << " ";
        // assert(count(n, ans) == 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;
    }
    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 = 0; i < n; i++) {
                for (int j = 0; j < i; j++) {
                    std::cout << ans[i][j] << " \n"[j == i - 1];
                }
            }
            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;
}

详细

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:


result:


Subtask #2:

score: 0
Wrong Answer

Test #58:

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

input:

1
4 4

output:

No

result:

ok good job! (1 test case)

Test #59:

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

input:

1
5 10

output:

No

result:

ok good job! (1 test case)

Test #60:

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

input:

1
6 20

output:

No

result:

ok good job! (1 test case)

Test #61:

score: 0
Accepted
time: 486ms
memory: 3820kb

input:

1
7 35

output:

No

result:

ok good job! (1 test case)

Test #62:

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

input:

1
5 10

output:

No

result:

ok good job! (1 test case)

Test #63:

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

input:

1
6 19

output:

No

result:

ok good job! (1 test case)

Test #64:

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

input:

1
6 20

output:

No

result:

ok good job! (1 test case)

Test #65:

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

input:

1
7 33

output:

No

result:

ok good job! (1 test case)

Test #66:

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

input:

1
7 33

output:

No

result:

ok good job! (1 test case)

Test #67:

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

input:

1
4 3

output:

No

result:

ok good job! (1 test case)

Test #68:

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

input:

1
5 8

output:

No

result:

ok good job! (1 test case)

Test #69:

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

input:

1
6 17

output:

No

result:

ok good job! (1 test case)

Test #70:

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

input:

1
7 30

output:

No

result:

ok good job! (1 test case)

Test #71:

score: -4
Wrong Answer
time: 0ms
memory: 3824kb

input:

2
3 0
3 1

output:

Yes
1
1 1
Yes
1
0 1

result:

wrong answer The string on the 2-th line should contain exactly 2 characters (test case 1)

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #4:

0%

Subtask #6:

score: 0
Skipped

Dependency #1:

0%