結果
問題 | No.2663 Zero-Sum Submatrices |
ユーザー | 2qbingxuan |
提出日時 | 2024-03-08 21:39:34 |
言語 | C++23 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 4,276 bytes |
コンパイル時間 | 3,397 ms |
コンパイル使用メモリ | 260,364 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-09-29 19:06:00 |
合計ジャッジ時間 | 4,659 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,248 KB |
testcase_02 | AC | 2 ms
5,248 KB |
testcase_03 | AC | 2 ms
5,248 KB |
testcase_04 | AC | 2 ms
5,248 KB |
testcase_05 | AC | 2 ms
5,248 KB |
testcase_06 | AC | 2 ms
5,248 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 2 ms
5,248 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | AC | 2 ms
5,248 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | AC | 2 ms
5,248 KB |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | AC | 2 ms
5,248 KB |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | AC | 2 ms
5,248 KB |
testcase_29 | WA | - |
testcase_30 | AC | 2 ms
5,248 KB |
ソースコード
// An AC a day keeps the doctor away. #pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; /*{{{*/ #define all(x) begin(x), end(x) #ifdef CKISEKI #include <experimental/iterator> #define safe cerr<<__PRETTY_FUNCTION__<<" line "<<__LINE__<<" safe\n" #define debug(a...) debug_(#a, a) #define orange(a...) orange_(#a, a) void debug_(auto s, auto ...a) { cerr << "\e[1;32m(" << s << ") = ("; int f = 0; (..., (cerr << (f++ ? ", " : "") << a)); cerr << ")\e[0m\n"; } void orange_(auto s, auto L, auto R) { cerr << "\e[1;33m[ " << s << " ] = [ "; using namespace experimental; copy(L, R, make_ostream_joiner(cerr, ", ")); cerr << " ]\e[0m\n"; } #else #define safe ((void)0) #define debug(...) safe #define orange(...) safe #endif template <typename T, T MOD> class Modular { public: constexpr Modular() : v() {} template <typename U> Modular(const U &u) { v = (0 <= u && u < MOD ? u : (u%MOD+MOD)%MOD); } template <typename U> explicit operator U() const { return U(v); } T operator()() const { return v; } #define REFOP(type, expr...) Modular &operator type (const Modular &rhs) { return expr, *this; } REFOP(+=, v += rhs.v - MOD, v += MOD & (v >> width)) ; REFOP(-=, v -= rhs.v, v += MOD & (v >> width)) // fits for MOD^2 <= 9e18 REFOP(*=, v = static_cast<T>(1LL * v * rhs.v % MOD)) ; REFOP(/=, *this *= inverse(rhs.v)) #define VALOP(op) friend Modular operator op (Modular a, const Modular &b) { return a op##= b; } VALOP(+) ; VALOP(-) ; VALOP(*) ; VALOP(/) Modular operator-() const { return 0 - *this; } friend bool operator == (const Modular &lhs, const Modular &rhs) { return lhs.v == rhs.v; } friend bool operator != (const Modular &lhs, const Modular &rhs) { return lhs.v != rhs.v; } friend std::istream & operator>>(std::istream &I, Modular &m) { T x; I >> x, m = x; return I; } friend std::ostream & operator<<(std::ostream &O, const Modular &m) { return O << m.v; } private: constexpr static int width = sizeof(T) * 8 - 1; T v; static T inverse(T a) { // copy from tourist's template T u = 0, v = 1, m = MOD; while (a != 0) { T t = m / a; m -= t * a; std::swap(a, m); u -= t * v; std::swap(u, v); } assert(m == 1); return u; } }; using lld = int64_t; using llf = long double; template <typename T> using max_heap = std::priority_queue<T,vector<T>,less<T> >; template <typename T> using min_heap = std::priority_queue<T,vector<T>,greater<T> >; template <typename V, typename T> int get_pos(const V &v, T x) { return lower_bound(all(v),x) - begin(v); } template <typename V> void sort_uni(V &v) { sort(all(v)), v.erase(unique(all(v)),end(v)); } template <typename T> bool chmin(T &x, const T &v) { return v < x ? (x=v, true) : false; } template <typename T> bool chmax(T &x, const T &v) { return x < v ? (x=v, true) : false; } constexpr inline lld cdiv(lld x, lld m) { return x/m + (x%m ? (x<0) ^ (m>0) : 0); } // ceiling divide constexpr inline lld modpow(lld e,lld p,lld m) { lld r=1; for(e%=m;p;p>>=1,e=e*e%m) if(p&1) r=r*e%m; return r; }/*}}}*/ constexpr llf eps = 1e-9; constexpr lld maxn = 200025, INF = 1e18, mod = 998244353, K = 14699, inf = 1e9; using Mint = Modular<int, mod>; Mint modpow(Mint e, uint64_t p) { Mint r = 1; while (p) (p&1) && (r *= e), e *= e, p >>= 1; return r; } // 0^0 = 1 const auto dummy = [] { return cin.tie(nullptr)->sync_with_stdio(false); }(); signed main() { int n, m; cin >> n >> m; if (min(n, m) >= 2) { cout << -1 << '\n'; return 0; } auto A = vector(1 << n, vector(1 << m, 0)); for (int i = 0; i < (1 << n); i++) { for (int j = 0; j < (1 << m); j++) { if (n > m) { int k = (i + j) % (1 << m); A[i][j] = k | (i << m); } else { int k = (i + j) % (1 << n); A[i][j] = k | (j << n); } } } for (int i = 0; i < (1 << n); i++) for (int j = 0; j < (1 << m); j++) cout << A[i][j] << (j+1==(1<<m) ? '\n' : ' '); /* for (int i = 0; i < (1 << n); i++) */ /* for (int j = i + 1; j < (1 << n); j++) */ /* for (int k = 0; k < (1 << m); k++) */ /* for (int l = k + 1; l < (1 << m); l++) */ /* debug(A[i][l] ^ A[i][k] ^ A[j][l] ^ A[j][k]); */ }