結果

問題 No.1169 Row and Column and Diagonal
ユーザー Manuel1024
提出日時 2021-03-19 21:04:32
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 551 bytes
コンパイル時間 662 ms
コンパイル使用メモリ 71,672 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-18 20:24:50
合計ジャッジ時間 2,229 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<vector<int>> ans(n, vector<int>(n));
    for(int start = 0; start < n; start++){
        int si = start, sj = (start*2)%n;
        ans[si][sj] = 1;
        for(int i = 1; i < n; i++){
            ans[(si+i)%n][(sj+i)%n] = i+1;
        }
    }

    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            cout << ans[i][j];
            if(j == n-1) cout << endl;
            else cout << " ";
        }
    }
    return 0;
}
0