結果

問題 No.1169 Row and Column and Diagonal
ユーザー kuramubonnkuramubonn
提出日時 2023-03-27 08:26:07
言語 C++23(draft)
(gcc 12.2.0 + boost 1.81.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 672 bytes
コンパイル時間 1,330 ms
コンパイル使用メモリ 89,636 KB
実行使用メモリ 4,452 KB
最終ジャッジ日時 2023-07-19 11:31:35
合計ジャッジ時間 3,205 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 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,384 KB
testcase_09 AC 12 ms
4,384 KB
testcase_10 AC 22 ms
4,388 KB
testcase_11 AC 24 ms
4,380 KB
testcase_12 AC 25 ms
4,384 KB
testcase_13 AC 25 ms
4,452 KB
testcase_14 AC 26 ms
4,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    int N;
    cin >> N;

    vector<vector<int> > data(N, vector<int>(N));


    for(int i = 0 ; i < N ; ++i){
        int y = i;
        int x = i;
        for(int j = 0 ; j < N ; ++j){
            data[x][y] = i+1;
            y--;
            if(y < 0)y = N - 1;
            x++;
            if(x >= N) x = 0;
        }

    }

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

}
0