提出番号 | 2378 |
---|---|

提出者 | kya |

言語 | C++ |

提出日時 | 2020-04-27 22:52:12 |

問題名 | (69)机の配置 |

結果 | WA |

点数 | 0% |

テストケース | 結果 | 得点 | 実行時間 | メモリ使用量 |
---|---|---|---|---|

1 | AC | 100% | 2ms | 7616KB |

2 | WA | 0% | 2ms | 8112KB |

3 | AC | 100% | 2ms | 8560KB |

4 | WA | 0% | 2ms | 8560KB |

5 | WA | 0% | 2ms | 7824KB |

6 | AC | 100% | 2ms | 7872KB |

7 | AC | 100% | 2ms | 7872KB |

8 | AC | 100% | 2ms | 8560KB |

9 | AC | 100% | 2ms | 8096KB |

10 | WA | 0% | 2ms | 7856KB |

11 | WA | 0% | 2ms | 8096KB |

12 | AC | 100% | 2ms | 7872KB |

13 | AC | 100% | 2ms | 8512KB |

14 | AC | 100% | 2ms | 7728KB |

15 | WA | 0% | 2ms | 7872KB |

16 | WA | 0% | 2ms | 8464KB |

17 | WA | 0% | 2ms | 7856KB |

18 | WA | 0% | 2ms | 7600KB |

19 | AC | 100% | 2ms | 7856KB |

20 | WA | 0% | 2ms | 8544KB |

21 | AC | 100% | 2ms | 7728KB |

22 | WA | 0% | 2ms | 7856KB |

23 | WA | 0% | 2ms | 8512KB |

24 | AC | 100% | 2ms | 7728KB |

25 | WA | 0% | 2ms | 7728KB |

26 | WA | 0% | 2ms | 8544KB |

27 | WA | 0% | 2ms | 7904KB |

28 | AC | 100% | 2ms | 7600KB |

29 | WA | 0% | 2ms | 7728KB |

30 | AC | 100% | 2ms | 8032KB |

```
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, h, w;
cin >> n >> h >> w;
vector<string> s(h);
for (auto &e : s) cin >> e;
auto f = [&] (int i, int j, int k) -> bool {
int res = 0;
for (int t = j; t < min(j + k, w); t++) {
if (s[i][t] == '.') res++;
}
return (res == k);
};
auto g = [&] (int i, int j, int k) -> bool {
int res = 0;
for (int t = i; t < min(i + k, h); t++) {
if (s[t][j] == '.') res++;
}
return (res == k);
};
auto solve = [&] (int k) -> int {
int ans1 = 0, ans2 = 0;
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
if (f(i, j, k)) { j += k - 1; ans1++; }
}
}
for (int j = 0; j < w; j++) {
for (int i = 0; i < h; i++) {
if (g(i, j, k)) { i += k - 1; ans2++; }
}
}
return max(ans1, ans2);
};
for (int i = 1; i < n + 1; i++) {
cout << solve(i) << '\n';
}
return 0;
}
```