結果

問題 No.1587 012 Matrix
ユーザー ikashoppinikashoppin
提出日時 2021-07-08 23:17:56
言語 C++17
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 16 ms / 1,000 ms
コード長 916 bytes
コンパイル時間 1,903 ms
使用メモリ 4,520 KB
最終ジャッジ日時 2023-02-01 19:18:31
合計ジャッジ時間 3,604 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 2 ms
3,372 KB
testcase_01 AC 1 ms
3,416 KB
testcase_02 AC 2 ms
3,380 KB
testcase_03 AC 1 ms
3,352 KB
testcase_04 AC 2 ms
3,356 KB
testcase_05 AC 1 ms
3,460 KB
testcase_06 AC 2 ms
3,504 KB
testcase_07 AC 2 ms
3,352 KB
testcase_08 AC 1 ms
3,440 KB
testcase_09 AC 2 ms
3,428 KB
testcase_10 AC 2 ms
3,516 KB
testcase_11 AC 2 ms
3,420 KB
testcase_12 AC 4 ms
3,576 KB
testcase_13 AC 5 ms
3,760 KB
testcase_14 AC 7 ms
3,800 KB
testcase_15 AC 9 ms
3,904 KB
testcase_16 AC 11 ms
4,048 KB
testcase_17 AC 14 ms
4,272 KB
testcase_18 AC 14 ms
4,344 KB
testcase_19 AC 15 ms
4,328 KB
testcase_20 AC 16 ms
4,396 KB
testcase_21 AC 15 ms
4,520 KB
testcase_22 AC 2 ms
3,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using lli = long long;
#define rep(i,n) for(int i=0;i<n;i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T>
ostream &operator<<(ostream &os, const vector<T> &x){
    os << "{";
    for(size_t i = 0; i < x.size(); i++){
        if(i < x.size()-1) os << x[i] << ", ";
        else os << x[i];
    }
    os << "}";
    return os;
}

int main(void){
    int n;
    cin >> n;
    vector<vector<int>> s(n, vector<int>(n));
    rep(i, n) rep(j, n){
        if(i < j) s[i][j] = 0;
        else if(i > j) s[i][j] = 2;
        else{
            if(i%2 == 0) s[i][j] = 1;
            else s[i][j] = 2;
        }
    }
    rep(i, n){
        rep(j, n){
            cout << s[i][j];
        }
        cout << endl;
    }
    return 0;
}
0