結果
問題 |
No.455 冬の大三角
|
ユーザー |
![]() |
提出日時 | 2016-12-06 00:05:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 925 bytes |
コンパイル時間 | 756 ms |
コンパイル使用メモリ | 73,652 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-27 21:55:48 |
合計ジャッジ時間 | 2,837 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 52 WA * 2 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <numeric> int main() { int h, w; std::cin >> h >> w; std::vector<std::string> v(h); for (int i = 0; i < h; i++) { std::cin >> v[i]; } std::vector<int> count(w); for (int i = 0; i < w; i++) { int c = 0; for (int j = 0; j < h; j++) { if (v[j][i] == '*') { c++; } } count[i] = c; } bool change = false; for (int i = 0; i < w; i++) { if (count[i] != 2) { for (int j = 0; j < h; j++) { if (v[j][i] != '*') { v[j][i] = '*'; change = true; break; } } } if (change) break; } for (int i = 0; i < h; i++) { std::cout << v[i] << std::endl; } return 0; }