QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#484855#8651. Table TennisQwerty1232#0 20ms3604kbC++231.9kb2024-07-20 03:14:032024-07-20 03:14:03

Judging History

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

  • [2024-07-20 03:14:03]
  • 评测
  • 测评结果:0
  • 用时:20ms
  • 内存:3604kb
  • [2024-07-20 03:14:03]
  • 提交

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 (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;
    }
    return;
    for (int t = 0; t < 1e8; 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 = 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;
}

詳細信息

Subtask #1:

score: 0
Time Limit Exceeded

Test #1:

score: 5
Accepted
time: 20ms
memory: 3604kb

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
0
11
Yes
0
11
111
Yes
0
11
111
1111
Yes
0
11
111
1111
11111
Yes
0
11
111
1111
11111
111111
Yes
0
11
111
1111
11111
111111
1111111
Yes
0
11
111
1111
11111
111111
1111111
11111111
Yes
0
11
111
1111
11111
111111
1111111
11111111
111111111
Yes
0
11
111
1111
11111
111111
1111111
11111111
111111111
11...

result:

ok good job! (97 test cases)

Test #2:

score: -5
Time Limit Exceeded

input:

5
4839 0
127 0
22 0
7 0
5 0

output:


result:


Subtask #2:

score: 0
Wrong Answer

Test #58:

score: 0
Wrong Answer
time: 0ms
memory: 3580kb

input:

1
4 4

output:


result:

wrong output format Unexpected end of file - token expected (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%