結果

問題 No.1910 High Element on Grid
ユーザー HYEA LEE
提出日時 2021-11-08 16:52:08
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 610 bytes
コンパイル時間 1,963 ms
コンパイル使用メモリ 164,708 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-22 16:55:25
合計ジャッジ時間 7,146 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

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

vector<vector<int>> solve(vector<int> R, vector<int> C)
{
    int H = R.size(), W = C.size();
    vector<vector<int>> V(H, vector<int>(W));
    int tp = 0; for(auto&x: V) for(auto&y:x) y = ++tp;
    for(int i=1; i<H; ++i) V[i][0] = V[i][W-R[i]];
    for(int i=1; i<W; ++i) V[0][i] = V[H-C[i]][i];
    V[0][0] = tp;
    return V;
}

int main()
{
    int H, W; cin >> H >> W;
    vector<int> R(H), C(W);
    for(int&x: R) cin >> x;
    for(int&x: C) cin >> x;
    for(auto x: solve(R, C))
    {
        for(auto y: x) cout << y << " ";
        cout << endl;
    }
}
0