結果

問題 No.1587 012 Matrix
コンテスト
ユーザー Arjun P
提出日時 2026-10-07 22:33:50
言語 C++23(gcc16)
(gcc 16.1.0 + boost 1.92.0 + ACL)
コンパイル:
g++-16 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 7 ms / 1,000 ms
+ 511µs
コード長 1,831 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 5,299 ms
コンパイル使用メモリ 338,264 KB
実行使用メモリ 9,900 KB
最終ジャッジ日時 2026-10-07 22:33:59
合計ジャッジ時間 4,292 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;

// --------------------------- TEMPLATE/METAP ---------------------------

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

// --------------------------- MACROS & CONSTANTS ---------------------------

#define ll long long
#define endl '\n'
const ll MOD = 1e9+7;

// --------------------------- FUNCTIONS ---------------------------

bool isPrime(ll n) {
    if (n <= 1) return false;
    for (ll i = 2; i * i <= n; ++i)
        if (n % i == 0) return false;
    return true;
}

// --------------------------- OBSERVATIONS ---------------------------

/* OB1:

*/

/* OB2:

*/

/* Final:

*/
 
// --------------------------- MAIN ---------------------------

int main(){
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

    ll n; cin >> n;

    if (n % 2) {cout << "NO" << endl; return 0;}

    vector<vector<ll>> mat(n, vector<ll> (n, 0));

    for (int i = 0; i < n; ++i) {
        if (i < n / 2) {
            for (int j = 0; j < i; ++j) {
                mat[i][j] = 2;
            }
            mat[i][i] = 1;
        }
        else {
            for (int j = 0; j <= i; ++j) {
                mat[i][j] = 2;
            }
        }
    }

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            cout << mat[i][j];
        }
        cout << endl;
    }

    return 0;
}
0