結果

問題 No.459 C-VS for yukicoder
ユーザー hotpepsihotpepsi
提出日時 2016-12-12 23:35:14
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 643 ms / 2,000 ms
コード長 1,309 bytes
コンパイル時間 620 ms
コンパイル使用メモリ 71,764 KB
実行使用メモリ 4,660 KB
最終ジャッジ日時 2023-08-19 21:48:00
合計ジャッジ時間 6,189 ms
ジャッジサーバーID
(参考情報)
judge15 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,468 KB
testcase_03 AC 3 ms
4,484 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 3 ms
4,484 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 3 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 3 ms
4,384 KB
testcase_15 AC 5 ms
4,376 KB
testcase_16 AC 4 ms
4,376 KB
testcase_17 AC 3 ms
4,376 KB
testcase_18 AC 3 ms
4,380 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 3 ms
4,376 KB
testcase_21 AC 133 ms
4,400 KB
testcase_22 AC 643 ms
4,380 KB
testcase_23 AC 144 ms
4,380 KB
testcase_24 AC 45 ms
4,376 KB
testcase_25 AC 18 ms
4,380 KB
testcase_26 AC 176 ms
4,376 KB
testcase_27 AC 21 ms
4,380 KB
testcase_28 AC 17 ms
4,376 KB
testcase_29 AC 102 ms
4,380 KB
testcase_30 AC 62 ms
4,376 KB
testcase_31 AC 24 ms
4,428 KB
testcase_32 AC 3 ms
4,376 KB
testcase_33 AC 27 ms
4,376 KB
testcase_34 AC 33 ms
4,400 KB
testcase_35 AC 4 ms
4,380 KB
testcase_36 AC 38 ms
4,660 KB
testcase_37 AC 4 ms
4,380 KB
testcase_38 AC 28 ms
4,500 KB
testcase_39 AC 5 ms
4,376 KB
testcase_40 AC 22 ms
4,380 KB
testcase_41 AC 2 ms
4,376 KB
testcase_42 AC 23 ms
4,568 KB
testcase_43 AC 30 ms
4,444 KB
testcase_44 AC 7 ms
4,380 KB
testcase_45 AC 6 ms
4,376 KB
testcase_46 AC 6 ms
4,376 KB
testcase_47 AC 4 ms
4,400 KB
testcase_48 AC 31 ms
4,504 KB
testcase_49 AC 4 ms
4,380 KB
testcase_50 AC 26 ms
4,376 KB
testcase_51 AC 3 ms
4,376 KB
testcase_52 AC 14 ms
4,560 KB
testcase_53 AC 5 ms
4,376 KB
testcase_54 AC 28 ms
4,376 KB
testcase_55 AC 12 ms
4,380 KB
testcase_56 AC 22 ms
4,496 KB
testcase_57 AC 3 ms
4,380 KB
testcase_58 AC 34 ms
4,376 KB
testcase_59 AC 8 ms
4,376 KB
testcase_60 AC 14 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <cstring>

using namespace std;
typedef pair<int, int> II;

int main(int argc, char *argv[]) {
	int H, W, N;
	cin >> H >> W >> N;
	string s[10000];
	for (int i = 0; i < H; ++i) {
		cin >> s[i];
	}
	int r[10000] = {};
	for (int i = 0; i < W; ++i) {
		for (int j = H - 1; j >= 0 && s[j][i] == '#'; --j) {
			++r[i];
		}
	}
	vector<II> v;
	for (int i = 0; i < N; ++i) {
		int c;
		cin >> c;
		v.push_back(II(c, i));
	}
	sort(v.begin(), v.end());
	int b[30000][3] = {};
	int u[30000] = {};
	int pos = 0;
	for (int x = 0; x < W; ++x) {
		while (pos != v.size() && v[pos].first + 2 < x) {
			++pos;
		}
		for (int i = 0; i < r[x]; ++i) {
			bool f = false;
			for (int j = pos; j != v.size() && v[j].first <= x; ++j) {
				if (!u[v[j].second]) {
					f = true;
					u[v[j].second] = 1;
					b[v[j].second][x - v[j].first]++;
					break;
				}
			}
			if (!f) {
				for (int j = pos; j != v.size() && v[j].first <= x; ++j) {
					if (b[v[j].second][x - v[j].first] < 3) {
						b[v[j].second][x - v[j].first]++;
						break;
					}
				}
			}
		}
	}
	for (int i = 0; i < N; ++i) {
		for (int j = 3; j >= 1; --j) {
			for (int k = 0; k < 3; ++k) {
				cout << (b[i][k] >= j ? '#' : '.');
			}
			cout << endl;
		}
	}
	return 0;
}
0