結果

問題 No.1910 High Element on Grid
ユーザー ruthen71
提出日時 2022-04-22 23:52:37
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 783 bytes
コンパイル時間 2,556 ms
コンパイル使用メモリ 197,148 KB
最終ジャッジ日時 2025-01-28 20:50:35
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#ifdef _RUTHEN
#include "debug.hpp"
#else
#define show(...) true
#endif

using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
template <class T> using V = vector<T>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int H, W;
    cin >> H >> W;
    V<int> R(H), C(W);
    rep(i, H) cin >> R[i];
    rep(j, W) cin >> C[j];
    V<V<int>> A(H, V<int>(W));
    for (int i = 1; i < H; i++) {
        for (int j = 1; j < W; j++) {
            A[i][j] = i + j;
        }
    }
    for (int i = 1; i < H; i++) A[i][0] = W - R[i] + i;
    for (int j = 1; j < W; j++) A[0][j] = H - C[j] + j;
    A[0][0] = 1'000'000'000;
    show(A);
    rep(i, H) rep(j, W) cout << A[i][j] << " \n"[j == W - 1];
    return 0;
}
0