QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#234700#5438. Half MixedbigJWA 0ms3636kbC++202.2kb2023-11-01 21:00:032023-11-01 21:00:04

Judging History

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

  • [2023-11-01 21:00:04]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3636kb
  • [2023-11-01 21:00:03]
  • 提交

answer

#include <bits/stdc++.h>

template<typename P, typename Q> std::istream& operator>>(std::istream& is, std::pair<P, Q>& v) { std::cin >> v.first >> v.second; return is; }
template<typename P, typename Q> std::ostream& operator<<(std::ostream& os, std::pair<P, Q>& v) { std::cout << v.first << ' ' << v.second; return os; }
template<typename T, std::size_t N> std::istream& operator>>(std::istream& is, std::array<T, N>& v) { for (auto& i : v) is >> i; return is; }
template<typename T, std::size_t N> std::ostream& operator<<(std::ostream& os, std::array<T, N>& v) { for (auto& i : v) os << i << ' '; return os; }
template<typename T> std::istream& operator>>(std::istream& is, std::vector<T>& v) { for (auto& i : v) is >> i; return is; }
template<typename T> std::ostream& operator<<(std::ostream& os, std::vector<T>& v) { for (auto& i : v) os << i << ' '; return os; }
template<typename...Args> void debug(Args...args) { ((std::cerr << args << ' '), ...); std::cerr << '\n'; }
template<typename...Args> void println(Args...args) { ((std::cout << args << ' '), ...); std::cout << '\n'; }
template<typename P, typename Q> auto chmax(P& a, Q b) { a = (b > a ? b : a); return a == b; }
template<typename P, typename Q> auto chmin(P& a, Q b) { a = (b < a ? b : a); return a == b; }

using i64 = int64_t;

auto solve() {
    int n, m;
    std::cin >> n >> m;

    int tot = 0;
    int s1 = i64(1 + n) * n / 2 % 2;

    for (int i = 1; i <= m; i++) {
        tot ^= 1LL * s1 * i % 2;
    }

    if (tot & 1) {
        std::cout << "No\n";
        return;
    }

    bool rev = n > m;
    if (rev) std::swap(n, m);
    std::vector<int> a(m);
    a.front() = 1;
    a.back() = 1;
    std::vector ans(n, a);
    if (rev) {
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                std::cout << ans[j][i] << " \n"[j == n - 1];
            }
        }
    }
    else {
        for (auto it : ans) {
            std::cout << it << "\n";
        }
    }
}

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    int c;
    std::cin >> c;

    while (c--) {
        solve();
    }

    return 0;
}

詳細信息

Test #1:

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

input:

2
2 3
1 1

output:

1 0 1 
1 0 1 
No

result:

wrong answer Token "1" doesn't correspond to pattern "Yes|No" (test case 1)