結果

問題 No.1169 Row and Column and Diagonal
ユーザー kuramubonnkuramubonn
提出日時 2023-03-27 08:26:07
言語 C++23(draft)
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 672 bytes
コンパイル時間 921 ms
コンパイル使用メモリ 90,108 KB
実行使用メモリ 4,600 KB
最終ジャッジ日時 2023-10-19 13:59:25
合計ジャッジ時間 2,916 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 4 ms
4,348 KB
testcase_07 AC 7 ms
4,348 KB
testcase_08 AC 10 ms
4,348 KB
testcase_09 AC 14 ms
4,348 KB
testcase_10 AC 25 ms
4,452 KB
testcase_11 AC 26 ms
4,540 KB
testcase_12 AC 28 ms
4,588 KB
testcase_13 AC 28 ms
4,592 KB
testcase_14 AC 28 ms
4,600 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