結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int N; cin >> N;
    array<array<int,500>,500> grid;
    for(int i=0;i<N;++i) {
        for(int j=0;j<N;++j) {
            grid[(2*i+j)%N][(i+j)%N]=j%N+1;
        }
    }
    string ans="";
    for(int i = 0; i < N; ++i) {
        for(int j = 0; j < N; ++j) ans += to_string(grid[i][j])+" ";
        ans += "\n";
    }
    cout << ans;
    return 0;
}
0