結果

問題 No.3657 Gathering Stones
コンテスト
ユーザー fuji
提出日時 2026-08-30 14:35:48
言語 C++23(gcc16)
(gcc 16.1.0 + boost 1.92.0)
コンパイル:
g++-16 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
+ 618µs
コード長 704 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,385 ms
コンパイル使用メモリ 355,716 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-08-30 14:35:55
合計ジャッジ時間 4,519 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 57
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

int main() {
    int N, M; cin >> N >> M;
    vector<string> s(N);
    for (int i = 0; i < N; i++) {
        string S; cin >> S; s[i]= S;
    }

    vector<int> row(M, 0);
    for (int n = 0; n < N; n++) {
        for (int m = 0; m < M; m++) {
            if (s[n][m] == '#') row[m]++;
        }
    }

    vector<int> line(N, 0);
    for (int m = 0; m < M; m++) {
        for (int i = 0; i < row[m]; i++) {
            line[i]++;
        }
    }
    
    for (int n = 0; n < N; n++) {
        for (int m = 0; m < M; m++) {
            if (line[n] > m) cout << '#';
            else cout << '.';
        }
        cout << endl;
    }
}
0