結果

問題 No.1169 Row and Column and Diagonal
ユーザー Dente
提出日時 2020-08-14 21:45:25
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 560 bytes
コンパイル時間 2,161 ms
コンパイル使用メモリ 192,088 KB
最終ジャッジ日時 2025-01-12 23:33:30
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

signed main() {
    int n;
    cin >> n;
    int a[n][n];
    rep(i, n) {
        rep(j, n) {
            a[(i + j) % n][(i - j + n) % n] = i + 1;
        }
    }
    rep(i, n) {
        rep(j, n) {
            if(j) cout << " ";
            cout << a[i][j];
        }
        cout << endl;
    }
    return 0;
}
0