結果

問題 No.1587 012 Matrix
ユーザー ikashoppin
提出日時 2021-07-08 23:17:56
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 18 ms / 1,000 ms
コード長 916 bytes
コンパイル時間 2,324 ms
コンパイル使用メモリ 197,784 KB
最終ジャッジ日時 2025-01-22 19:20:41
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

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