結果

問題 No.3727 Garden Master
コンテスト
ユーザー てんぷら
提出日時 2026-09-19 14:05:28
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 17 ms / 2,000 ms
+ 463µs
コード長 1,108 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,579 ms
コンパイル使用メモリ 338,988 KB
実行使用メモリ 9,928 KB
最終ジャッジ日時 2026-09-19 14:05:42
合計ジャッジ時間 5,461 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
#ifdef TEMPURA
#else
#define debug(...) ((void)0)
#define msg(...) ((void)0)
#endif
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, m, n) for(int i = (int)(m); i < (int)(n); i++)

using ll = long long;
using ull = unsigned long long;
using i128 = __int128_t;

template <class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

template <class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
// #include <atcoder/modint>
// using mint = atcoder::modint998244353;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector a(n, vector(n, 0)), b(n, vector(n, 0));
    rep(i, n) rep(j, n) {
        a[i][j] = i + 1;
        b[i][j] = j + 1;
        if((i + j) % 2 == 0) {
            swap(a[i][j], b[i][j]);
        }
    }
    rep(i, n) rep(j, n) cout << a[i][j] << " \n"[j + 1 == n];
    rep(i, n) rep(j, n) cout << b[i][j] << " \n"[j + 1 == n];
    return 0;
}
0