結果

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

テストケース

テストケース 結果 得点 実行時間 メモリ使用量
1 AC 100% 2ms 8112KB
2 AC 100% 2ms 8448KB
3 AC 100% 2ms 8192KB
4 AC 100% 2ms 8400KB
5 AC 100% 2ms 8352KB
6 AC 100% 1ms 8352KB
7 AC 100% 2ms 7872KB
8 AC 100% 2ms 7232KB
9 AC 100% 2ms 8432KB
10 AC 100% 2ms 7984KB
11 AC 100% 2ms 8432KB
12 AC 100% 2ms 8384KB
13 AC 100% 2ms 8432KB
14 AC 100% 2ms 8432KB
15 AC 100% 2ms 7648KB
16 AC 100% 2ms 8080KB
17 AC 100% 2ms 8416KB
18 AC 100% 2ms 7984KB
19 AC 100% 1ms 7520KB
20 AC 100% 2ms 8016KB
21 AC 100% 2ms 7952KB
22 AC 100% 2ms 7600KB
23 AC 100% 2ms 7824KB
24 AC 100% 2ms 7920KB
25 AC 100% 2ms 8432KB
26 AC 100% 2ms 8400KB
27 AC 100% 2ms 8000KB
28 AC 100% 2ms 8256KB
29 AC 100% 2ms 7824KB
30 AC 100% 2ms 7824KB

ソースコード

#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

int solve(int n, const string& f){
  vector<int> dp(f.size()+1, 0);
  rep(i,f.size()+1){
    if(i>0) dp[i] = max(dp[i], dp[i-1]);
    if(i+n <= f.size()){
      bool check = true;
      rep(j,n) if(f[i+j] == '#') check = false;
      if(check){
        dp[i+n] += dp[i] + 1;
      }
    }
  }
  return dp[f.size()];
}


int main(){
  int N, H, W;
  cin >> N >> H >> W;
  vector<string> F;
  rep(i,H){
    string s;
    cin >> s;
    F.push_back(s);
  }

  REP(i,1,N+1){
    int ret = 0;
    rep(j,H){
      ret += solve(i, F[j]);
    }
    cout << ret << endl;
  } 
  return 0;
}