結果
| 問題 |
No.459 C-VS for yukicoder
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2016-12-10 01:50:58 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,966 bytes |
| コンパイル時間 | 857 ms |
| コンパイル使用メモリ | 92,196 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-28 21:15:04 |
| 合計ジャッジ時間 | 3,943 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 54 WA * 4 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 459.cc: No.459 C-VS for yukicoder - yukicoder
*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
using namespace std;
/* constant */
const int MAX_W = 10000;
const int MAX_N = 30000;
/* typedef */
struct Pack {
int id, x, bn, bs[3];
Pack() {}
bool operator<(const Pack &p) const {
return bn < p.bn || (bn == p.bn && id < p.id);
}
void print() {
for (int y = 0; y < 3; y++) {
for (int i = 0; i < 3; i++) putchar(y < bs[i] ? '#' : '.');
putchar('\n');
}
}
};
/* global variables */
int flds[MAX_W];
Pack ps[MAX_N];
/* subroutines */
bool comp_x(const Pack &p0, const Pack &p1) {
return p0.x < p1.x || (p0.x == p1.x && p0.id < p1.id);
}
bool comp_id(const Pack &p0, const Pack &p1) {
return p0.id < p1.id;
}
/* main */
int main() {
int h, w, n;
cin >> h >> w >> n;
for (int y = 0; y < h; y++) {
string s;
cin >> s;
for (int x = 0; x < w; x++)
if (s[x] == '#') flds[x]++;
}
//for (int x = 0; x < w; x++) printf("%d", flds[x]); putchar('\n');
for (int i = 0; i < n; i++) {
ps[i].id = i;
cin >> ps[i].x;
ps[i].bn = ps[i].bs[0] = ps[i].bs[1] = ps[i].bs[2] = 0;
}
sort(ps, ps + n, comp_x);
queue<Pack *> q;
for (int i = 0; i < n; i++) q.push(&ps[i]);
while (! q.empty()) {
Pack *pt = q.front(); q.pop();
int maxf = 0, maxi = -1;
for (int i = 0; i < 3; i++) {
int &fi = flds[pt->x + i];
if (pt->bs[i] < 3 && maxf < fi) maxf = fi, maxi = i;
}
if (maxf <= 0) continue;
flds[pt->x + maxi]--;
pt->bs[maxi]++;
pt->bn++;
q.push(pt);
}
sort(ps, ps + n, comp_id);
for (int i = 0; i < n; i++) ps[i].print();
return 0;
}
tnakao0123