結果
問題 |
No.459 C-VS for yukicoder
|
ユーザー |
![]() |
提出日時 | 2025-06-21 15:56:06 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 13 ms / 2,000 ms |
コード長 | 1,354 bytes |
コンパイル時間 | 3,435 ms |
コンパイル使用メモリ | 284,272 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-06-21 15:56:13 |
合計ジャッジ時間 | 7,275 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 58 |
ソースコード
#include <bits/stdc++.h> #define int long long //#define USE_FREOPEN //#define MUL_TEST #define FILENAME "tetris" using namespace std; void solve() { int h, w, n; cin >> h >> w >> n; vector<int> a(w); for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { char c; cin >> c; if (c == '#') a[x]++; } } vector<int> c(n); vector<vector<int> > cid(w - 2); for (int i = 0; i < n; i++) { cin >> c[i]; cid[c[i]].push_back(i); } vector<array<int, 3> > b(n); for (int x = 0; x < w - 2; x++) { for (auto i : cid[x]) { for (int dx = 0; dx < 3; dx++) { if (a[x + dx]) { a[x + dx]--; b[i][dx]++; break; } } } } for (int x = 0; x < w; x++) { for (int dx = 0; dx < 3; dx++) { if (0 <= x - dx && x - dx < w - 2) { for (auto i : cid[x - dx]) { while (a[x] && b[i][dx] < 3) { a[x]--; b[i][dx]++; } } } } } for (auto it : b) { for (int y = 0; y < 3; y++) { for (int x = 0; x < 3; x++) { cout << ((2 - y < it[x]) ? '#' : '.'); } cout << '\n'; } } } signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); #ifdef USE_FREOPEN freopen(FILENAME ".in", "r", stdin); freopen(FILENAME ".out", "w", stdout); #endif int _ = 1; #ifdef MUL_TEST cin >> _; #endif while (_--) solve(); _^=_; return 0^_^0; }