結果

問題 No.459 C-VS for yukicoder
ユーザー vjudge1
提出日時 2025-06-20 17:03:56
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 1,246 bytes
コンパイル時間 1,853 ms
コンパイル使用メモリ 167,292 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-06-20 17:04:04
合計ジャッジ時間 6,734 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 45 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

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


const int N = 30010;

int h, w, n, res[N][3];
vector<vector<char> > a;
vector<pair<int, int> > ha[N];

bool cmp (pair<int, int> a, pair<int, int> b) { int i = a.first, j = b.first; return res[i][0] + res[i][1] + res[i][2] < res[j][0] + res[j][1] + res[j][2]; }
signed main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> h >> w >> n;
	a.resize(h);
	for (int i = 0; i < h; i ++ )
	{
		a[i].resize(w);
		for (int j = 0; j < w; j ++ )
			cin >> a[i][j];
	}
	for (int i = 1, x; i <= n; i ++ )
	{
		cin >> x;
		ha[x].push_back({i, 0});
		ha[x + 1].push_back({i, 1});
		ha[x + 2].push_back({i, 2});
	}
	for (int i = 0; i < w; i ++ )
	{
		int s = ha[i].size();
		if (s == 0) continue;
		sort(ha[i].begin(), ha[i].end(), cmp);
		int tot = 0;
		for (int j = 0; j < h; j ++ ) tot += a[j][i] != '.';
		for (int j = 0; j < tot % s; j ++ ) 
			res[ha[i][j].first][ha[i][j].second] = tot / s + 1;
		for (int j = tot % s; j < s; j ++ )
			res[ha[i][j].first][ha[i][j].second] = tot / s;
	}
	for (int i = 1; i <= n; i ++ )
		for (int x = 0; x < 3; x ++ , cout << "\n")
			for (int y = 0; y < 3; y ++ )
				if (x <= res[i][y] - 1) cout << '#';
				else cout << ".";
	return 0;
}
0