QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#578546 | #6189. Full Clue Problem | xin11 | WA | 0ms | 3620kb | C++23 | 3.8kb | 2024-09-20 19:54:25 | 2024-09-20 19:54:29 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
template <unsigned M_> struct ModInt {
static constexpr unsigned M = M_;
unsigned x;
constexpr ModInt() : x(0) {}
constexpr ModInt(unsigned x_) : x(x_ % M) {}
constexpr ModInt(unsigned long long x_) : x(x_ % M) {}
constexpr ModInt(int x_) : x(((x_ %= static_cast<int>(M)) < 0) ? (x_ + static_cast<int>(M)) : x_) {}
constexpr ModInt(long long x_) : x(((x_ %= static_cast<long long>(M)) < 0) ? (x_ + static_cast<long long>(M)) : x_) {}
ModInt &operator+=(const ModInt &a) {
x = ((x += a.x) >= M) ? (x - M) : x;
return *this;
}
ModInt &operator-=(const ModInt &a) {
x = ((x -= a.x) >= M) ? (x + M) : x;
return *this;
}
ModInt &operator*=(const ModInt &a) {
x = (static_cast<unsigned long long>(x) * a.x) % M;
return *this;
}
ModInt &operator/=(const ModInt &a) { return (*this *= a.inv()); }
ModInt pow(long long e) const {
if (e < 0)
return inv().pow(-e);
ModInt a = *this, b = 1;
for (; e; e >>= 1) {
if (e & 1)
b *= a;
a *= a;
}
return b;
}
ModInt inv() const {
unsigned a = M, b = x;
int y = 0, z = 1;
for (; b;) {
const unsigned q = a / b;
const unsigned c = a - q * b;
a = b;
b = c;
const int w = y - static_cast<int>(q) * z;
y = z;
z = w;
}
assert(a == 1);
return ModInt(y);
}
ModInt operator+() const { return *this; }
ModInt operator-() const {
ModInt a;
a.x = x ? (M - x) : 0;
return a;
}
ModInt operator+(const ModInt &a) const { return (ModInt(*this) += a); }
ModInt operator-(const ModInt &a) const { return (ModInt(*this) -= a); }
ModInt operator*(const ModInt &a) const { return (ModInt(*this) *= a); }
ModInt operator/(const ModInt &a) const { return (ModInt(*this) /= a); }
template <class T> friend ModInt operator+(T a, const ModInt &b) { return (ModInt(a) += b); }
template <class T> friend ModInt operator-(T a, const ModInt &b) { return (ModInt(a) -= b); }
template <class T> friend ModInt operator*(T a, const ModInt &b) { return (ModInt(a) *= b); }
template <class T> friend ModInt operator/(T a, const ModInt &b) { return (ModInt(a) /= b); }
explicit operator bool() const { return x; }
bool operator==(const ModInt &a) const { return (x == a.x); }
bool operator!=(const ModInt &a) const { return (x != a.x); }
friend std::ostream &operator<<(std::ostream &os, const ModInt &a) { return os << a.x; }
};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
using ll = long long;
// using mint = ModInt<1000000007U>;
using mint = ModInt<998244353U>;
void solve() {
int n;
cin >> n;
vector<vector<int>> clues(20, vector<int>(20));
clues[0][0] = clues[1][1] = 2;
clues[0][1] = clues[1][0] = 3;
clues[0][2] = clues[1][2] = clues[2][0] = clues[2][1] = 1;
vector<vector<int>> solA(20, vector<int>(20));
auto solB = solA;
solA[0][0] = solA[0][1] = solA[1][0] = 1;
solB[1][1] = solB[0][1] = solB[1][0] = 1;
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
cout << clues[i][j] << " \n"[j + 1 == n];
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
cout << solA[i][j] << " \n"[j + 1 == n];
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
cout << solB[i][j] << " \n"[j + 1 == n];
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T = 1;
// cin >> T;
for (int tc = 1; tc <= T; tc++) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3620kb
input:
5
output:
2 3 1 0 0 3 2 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
result:
wrong answer (1, 2) doesn't satisfy with clues