結果
問題 |
No.1427 Simplified Tetris
|
ユーザー |
![]() |
提出日時 | 2025-06-22 11:49:58 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,467 bytes |
コンパイル時間 | 692 ms |
コンパイル使用メモリ | 77,800 KB |
実行使用メモリ | 7,848 KB |
最終ジャッジ日時 | 2025-06-22 11:50:07 |
合計ジャッジ時間 | 8,655 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 4 |
other | WA * 37 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int H, W, N; cin >> H >> W >> N; vector<string> grid(H); for (int i = 0; i < H; ++i) { cin >> grid[i]; } vector<int> C(N); for (int i = 0; i < N; ++i) { cin >> C[i]; } vector<vector<string>> packages(N, vector<string>(3, "...")); for (int i = N - 1; i >= 0; --i) { int c = C[i]; int max_h = -1; // Find the highest row where the package would land for (int x = c; x < c + 3; ++x) { for (int y = H - 1; y >= 0; --y) { if (grid[y][x] == '#') { max_h = max(max_h, y); break; } } } if (max_h == -1) { max_h = H - 1; } else { max_h--; } // Determine the package shape for (int dy = 0; dy < 3; ++dy) { for (int dx = 0; dx < 3; ++dx) { int y = max_h - dy; int x = c + dx; if (y >= 0 && y < H && x >= 0 && x < W && grid[y][x] == '#') { packages[i][2 - dy][dx] = '#'; grid[y][x] = '.'; } } } } // Output the packages in order for (int i = 0; i < N; ++i) { for (int j = 0; j < 3; ++j) { cout << packages[i][j] << endl; } } return 0; }