QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#484837#8651. Table TennisQwerty1232#0 4ms3884kbC++231.4kb2024-07-20 02:57:532024-07-20 02:57:53

Judging History

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

  • [2024-07-20 02:57:53]
  • 评测
  • 测评结果:0
  • 用时:4ms
  • 内存:3884kb
  • [2024-07-20 02:57:53]
  • 提交

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();
    for (int t = 0; t < 1e3 * n; t++) {
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                int b = rnd() % int(1e9 + 7) % 2;
                ans[i][j] = b;
                ans[j][i] = !b;
            }
        }
        int cnt = count(n, ans);
        if (cnt == 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;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Time Limit Exceeded

Test #1:

score: 0
Time Limit Exceeded

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: 3816kb

input:

1
4 4

output:

No

result:

ok good job! (1 test case)

Test #59:

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

input:

1
5 10

output:

No

result:

ok good job! (1 test case)

Test #60:

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

input:

1
6 20

output:

No

result:

ok good job! (1 test case)

Test #61:

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

input:

1
7 35

output:

No

result:

ok good job! (1 test case)

Test #62:

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

input:

1
5 10

output:

No

result:

ok good job! (1 test case)

Test #63:

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

input:

1
6 19

output:

No

result:

ok good job! (1 test case)

Test #64:

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

input:

1
6 20

output:

No

result:

ok good job! (1 test case)

Test #65:

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

input:

1
7 33

output:

No

result:

ok good job! (1 test case)

Test #66:

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

input:

1
7 33

output:

No

result:

ok good job! (1 test case)

Test #67:

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

input:

1
4 3

output:

No

result:

ok good job! (1 test case)

Test #68:

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

input:

1
5 8

output:

No

result:

ok good job! (1 test case)

Test #69:

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

input:

1
6 17

output:

No

result:

ok good job! (1 test case)

Test #70:

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

input:

1
7 30

output:

No

result:

ok good job! (1 test case)

Test #71:

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

input:

2
3 0
3 1

output:

Yes
1
1 0
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%