結果

問題 No.2212 One XOR Matrix
ユーザー 👑 emthrmemthrm
提出日時 2023-02-11 00:23:10
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,576 bytes
コンパイル時間 3,578 ms
コンパイル使用メモリ 252,120 KB
実行使用メモリ 8,268 KB
最終ジャッジ日時 2023-09-22 00:59:32
合計ジャッジ時間 5,533 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr double EPS = 1e-8;
constexpr int MOD = 998244353;
// constexpr int MOD = 1000000007;
constexpr int DY4[]{1, 0, -1, 0}, DX4[]{0, -1, 0, 1};
constexpr int DY8[]{1, 1, 0, -1, -1, -1, 0, 1};
constexpr int DX8[]{0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U>
inline bool chmax(T& a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U>
inline bool chmin(T& a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  int n; cin >> n;
  if (n == 1) {
    cout << "-1\n";
    return 0;
  }
  vector<vector<int>> a{
    {7, 14, 0, 8},
    {4, 12, 2, 11},
    {15, 9, 6, 1},
    {13, 10, 5, 3}
  };
  FOR(m, 2, n) {
    vector b(2 << m, vector(2 << m, 0));
    REP(i, 1 << m) copy(ALL(a[i]), b[i].begin());
    REP(i, 1 << m) REP(j, 1 << m) b[(1 << m) + i][(1 << m) + j] = a[i][j] + (4 << m);
    REP(i, 1 << m) iota(next(b[i].begin(), 1 << m), b[i].end(), (8 << m) + (1 << m) * i);
    REP(i, 1 << m) iota(b[(1 << m) + i].begin(), next(b[(1 << m) + i].begin(), 1 << m), (16 << m) + (1 << m) * i);
    a.swap(b);
  }
  REP(i, 1 << n) REP(j, 1 << n) cout << a[i][j] << " \n"[j + 1 == (1 << n)];
  return 0;
}
0