結果

問題 No.1169 Row and Column and Diagonal
ユーザー Manuel1024Manuel1024
提出日時 2021-03-19 21:04:32
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 551 bytes
コンパイル時間 628 ms
コンパイル使用メモリ 72,648 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-12 00:49:01
合計ジャッジ時間 3,122 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 4 ms
4,380 KB
testcase_07 AC 6 ms
4,380 KB
testcase_08 AC 10 ms
4,380 KB
testcase_09 AC 13 ms
4,380 KB
testcase_10 AC 23 ms
4,380 KB
testcase_11 AC 24 ms
4,376 KB
testcase_12 AC 25 ms
4,444 KB
testcase_13 AC 25 ms
4,384 KB
testcase_14 AC 26 ms
4,504 KB
権限があれば一括ダウンロードができます

ソースコード

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