QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#484860 | #8651. Table Tennis | Qwerty1232 | Compile Error | / | / | C++23 | 2.0kb | 2024-07-20 03:16:33 | 2024-07-20 03:16:33 |
Judging History
answer
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#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 (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 < 0.5e9 / pow(n, 3); 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;
b = rnd() % 2;
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
In file included from /usr/include/c++/13/string:43, from /usr/include/c++/13/bitset:52, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52, from answer.code:3: /usr/include/c++/13/bits/allocator.h: In destructor ‘constexpr std::_Bvector_base<std::allocator<bool> >::_Bvector_impl::~_Bvector_impl()’: /usr/include/c++/13/bits/allocator.h:184:7: error: inlining failed in call to ‘always_inline’ ‘constexpr std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = long unsigned int]’: target specific option mismatch 184 | ~allocator() _GLIBCXX_NOTHROW { } | ^ In file included from /usr/include/c++/13/vector:67, from /usr/include/c++/13/functional:64, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53: /usr/include/c++/13/bits/stl_bvector.h:557:14: note: called from here 557 | struct _Bvector_impl | ^~~~~~~~~~~~~