結果
| 問題 |
No.459 C-VS for yukicoder
|
| コンテスト | |
| ユーザー |
commy
|
| 提出日時 | 2019-03-31 02:40:44 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 99 ms / 2,000 ms |
| コード長 | 1,742 bytes |
| コンパイル時間 | 699 ms |
| コンパイル使用メモリ | 80,116 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-17 21:27:31 |
| 合計ジャッジ時間 | 3,857 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 58 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#ifdef _DEBUG_
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl
#else
#define dump(val)
#endif
using namespace std;
typedef long long int ll;
template<typename T>
vector<T> make_v(size_t a, T b) {
return vector<T>(a, b);
}
template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int w, h, n;
cin >> h >> w >> n;
vector<int> M(w, 0);
REP(i, 0, h) {
string s;
cin >> s;
REP(j, 0, s.size()) {
M[j] += (s[j] == '#');
}
}
vector<int> C(n);
vector<int> X(w, 0);
REP(i, 0, n) {
cin >> C[i];
X[C[i]]++;
}
vector<int> I(n);
REP(i, 0, n) {
I[i] = i;
}
sort(begin(I), end(I), [&](int a, int b) { return C[a] < C[b]; });
int l = 0, r = 0, index = 0;
auto ans = make_v(n, 4, 0);
REP(i, 0, w) {
r += X[i];
index = max(index, l);
REP (j, l, r) {
if (ans[I[j]][3] == 0) {
index = j;
break;
}
}
REP(j, 0, M[i]) {
ans[I[index]][i - C[I[index]]]++;
ans[I[index]][3]++;
index = l + ((index + 1 - l) % (r - l));
}
if (i - 2 >= 0) {
l += X[i - 2];
}
}
REP (i, 0, n) {
REP (j, 0, 3) {
REP (k, 0, 3) {
cout << (ans[i][k] > j ? '#' : '.');
}
cout << endl;
}
}
return 0;
}
commy