結果

問題 No.459 C-VS for yukicoder
ユーザー femtofemto
提出日時 2016-12-10 02:56:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,497 bytes
コンパイル時間 2,005 ms
コンパイル使用メモリ 174,012 KB
実行使用メモリ 5,624 KB
最終ジャッジ日時 2023-08-19 08:03:45
合計ジャッジ時間 15,532 ms
ジャッジサーバーID
(参考情報)
judge9 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 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 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,384 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 RE -
testcase_18 RE -
testcase_19 WA -
testcase_20 RE -
testcase_21 AC 135 ms
5,624 KB
testcase_22 AC 122 ms
4,816 KB
testcase_23 AC 127 ms
5,328 KB
testcase_24 AC 45 ms
4,380 KB
testcase_25 WA -
testcase_26 AC 15 ms
4,376 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 43 ms
4,380 KB
testcase_30 AC 15 ms
4,380 KB
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 WA -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
testcase_47 RE -
testcase_48 WA -
testcase_49 RE -
testcase_50 RE -
testcase_51 RE -
testcase_52 RE -
testcase_53 RE -
testcase_54 RE -
testcase_55 WA -
testcase_56 WA -
testcase_57 RE -
testcase_58 WA -
testcase_59 RE -
testcase_60 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;


struct Block {
	int id, pos;
	int num[3];
	Block(int id, int pos) : id(id), pos(pos) {
		for(int i = 0; i < 3; i++) {
			num[i] = 0;
		}
	}
};
bool comp1(Block b1, Block b2) {
	return b1.pos < b2.pos;
}
bool comp2(Block b1, Block b2) {
	return b1.id < b2.id;
}

int num[10000];
vector<P> p[10000];

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int H, W, N;
	cin >> H >> W >> N;

	for(int i = 0; i < H; i++) {
		for(int j = 0; j < W; j++) {
			char c;
			cin >> c;
			if(c == '#') num[j]++;
		}
	}

	vector<Block> block;
	for(int i = 0; i < N; i++) {
		int pos;
		cin >> pos;
		block.push_back(Block(i, pos));
		for(int j = 0; j < 3; j++) {
			p[pos + j].push_back(P(i, j));
		}
	}
	sort(block.begin(), block.end(), comp1);
	for(auto& b : block) {
		bool flag = false;
		for(int i = 0; i < 3; i++) {
			if(num[b.pos + i] > 0) {
				num[b.pos + i]--;
				b.num[i]++;
				flag = true;
				break;
			}
		}
		assert(flag);
	}

	for(int j = 0; j < W; j++) {
		if(num[j] == 0) continue;
		for(auto v : p[j]) {
			int idx = v.first, col = v.second;
			while(block[idx].num[col] < 3 && num[j] > 0) {
				block[idx].num[col]++;
				num[j]--;
			}
		}
		assert(num[j] == 0);
	}

	sort(block.begin(), block.end(), comp2);

	for(auto b : block) {
		for(int i = 0; i < 3; i++) {
			for(int j = 0; j < 3; j++) {
				if(i >= 3 - b.num[j]) cout << '#';
				else cout << '.';
			}
			cout << endl;
		}
	}
}
0