Advertisement
mickypinata

PROG-T1001: Brick

Sep 15th, 2021
644
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. const int N = 19;
  5.  
  6. char board[N + 1][N + 2];
  7. int mn[N + 1];
  8.  
  9. int main(){
  10.  
  11.     int row, col;
  12.     scanf("%d%d", &row, &col);
  13.     for(int j = 1; j <= col; ++j){
  14.         mn[j] = row + 1;
  15.     }
  16.     for(int i = 1; i <= row; ++i){
  17.         for(int j = 1; j <= col; ++j){
  18.             scanf(" %c", &board[i][j]);
  19.             if(board[i][j] == 'O'){
  20.                 mn[j] = min(mn[j], i);
  21.             }
  22.         }
  23.     }
  24.     for(int j = 1; j <= col; ++j){
  25.         int cnt;
  26.         scanf("%d", &cnt);
  27.         for(int i = mn[j] - 1; i >= mn[j] - cnt; --i){
  28.             board[i][j] = '#';
  29.         }
  30.     }
  31.     for(int i = 1; i <= row; ++i){
  32.         for(int j = 1; j <= col; ++j){
  33.             cout << board[i][j];
  34.         }
  35.         cout << '\n';
  36.     }
  37.  
  38.     return 0;
  39. }
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement