結果

問題 No.1130 Grid Numbers
ユーザー hiragnhiragn
提出日時 2020-08-21 17:36:29
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 504 bytes
コンパイル時間 1,943 ms
コンパイル使用メモリ 200,572 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-23 04:55:39
合計ジャッジ時間 2,588 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:11:27: warning: 'W' may be used uninitialized [-Wmaybe-uninitialized]
   11 |         for (int j = 0; j < W; ++j) {
      |                         ~~^~~
main.cpp:6:12: note: 'W' was declared here
    6 |     int H, W;
      |            ^

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
    int H, W;
    cin >> H, W;

    map<int, int> mp;
    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            int t;
            cin >> t;
            mp[t]++;
        }
    }

    int cur = 0;
    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            while (mp[cur] == 0) cur++;
            cout << cur << " ";
            mp[cur]--;
        }
        cout << endl;
    }
    return 0;
}
0