結果

提出番号 1588
提出者 shot
言語 C++
提出日時 2018-08-04 13:13:05
問題名 (69)机の配置
結果 AC
点数 100%

テストケース

テストケース 結果 得点 実行時間 メモリ使用量
1 AC 100% 2ms 7840KB
2 AC 100% 2ms 8384KB
3 AC 100% 1ms 7920KB
4 AC 100% 2ms 7760KB
5 AC 100% 2ms 8688KB
6 AC 100% 1ms 8304KB
7 AC 100% 1ms 8720KB
8 AC 100% 2ms 7232KB
9 AC 100% 1ms 8080KB
10 AC 100% 1ms 7808KB
11 AC 100% 2ms 8064KB
12 AC 100% 1ms 8720KB
13 AC 100% 2ms 8160KB
14 AC 100% 2ms 8192KB
15 AC 100% 1ms 8416KB
16 AC 100% 2ms 8368KB
17 AC 100% 1ms 8256KB
18 AC 100% 1ms 8736KB
19 AC 100% 2ms 7248KB
20 AC 100% 1ms 8704KB
21 AC 100% 1ms 8080KB
22 AC 100% 2ms 8096KB
23 AC 100% 2ms 7248KB
24 AC 100% 2ms 8368KB
25 AC 100% 2ms 8048KB
26 AC 100% 1ms 7504KB
27 AC 100% 1ms 8096KB
28 AC 100% 1ms 8272KB
29 AC 100% 1ms 8080KB
30 AC 100% 1ms 8704KB

ソースコード

#include <bits/stdc++.h>
using namespace std;

#define int long long

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N, H, W;
  cin >> N >> H >> W;

  vector<string> dat(H);
  for ( int i = 0; i < H; i++ ) cin >> dat[i];

  for ( int i = 1; i <= N; i++ ) {
    vector<string> tmp = dat;
    int cnt = 0;
    for ( int j = 0; j < H; j++ ) {
      for ( int k = 0; k <= W-i; k++ ) {
	bool flag = true;
	for ( int l = k; l < k+i; l++ ) {
	  if ( tmp[j][l] == '#' ) {
	    flag = false;
	    break;
	  }
	}
	if ( flag ) {
	  for ( int l = k; l < k+i; l++ ) {
	    tmp[j][l] = '#';	    
	  } 
	  cnt++;
	}
      }
    }

    cout << cnt << endl;
  }
  
  return 0;
}