結果

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

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vs = vector<string>;
using vpi = vector<pair<int, int>>;
using vpl = vector<pair<ll, ll>>;
#define rep(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define repr(i, s, n) for (int i = (s); i >= (int)(n); --i)
#define sz(x) ((int)(x).size())
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
auto _ = []{ios::sync_with_stdio(false); cin.tie(nullptr); return 0;}();
const int INFI = 1 << 30;
const ll INFL = 1LL << 62;

vvi rotate (vvi& grid, int times) {
	int h = grid.size ();
	int w = grid[0].size ();
	vvi res=grid; 
	times %= 4; 

	rep (i, 0, times){
		vvi rotatedGrid (w, vector<int> (h));
		rep (j, 0, h){
			rep (k, 0, w) rotatedGrid[k][h - j - 1] = res[j][k];
			}
		res = rotatedGrid;
		swap (h, w); 
	}
	return res;
}

int main() {
	int h, w;
	cin >> h >> w;
	vvi a(h,vi(w,0));
	vvi aa=a;

	rep (i, 0, h){
		rep (j, 0, w){
			char c;
			cin >> c;
			if(c=='#')a[i][j]=1;
		}
	}
	rep (j, 0, w){
		int sm=0;
		rep (i, 0, h){
			if(a[i][j])sm++;
		}
		rep (i, 0, sm){
			aa[i][j]=1;
		}
	}
	vector<vector<char>>ans(h,vector<char>(w,'.'));
	rep (i, 0, h){
		int sm=accumulate(aa[i].begin(), aa[i].end(), 0);
		rep (j, 0, sm){
			ans[i][j]='#';
		}
	}
	for (auto x: ans){
		for (auto y: x){
			cout << y;
		}
	cout << '\n';
	}

	return 0;
}
0