結果
問題 | No.455 冬の大三角 |
ユーザー |
|
提出日時 | 2020-04-15 09:55:02 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 6 ms / 2,000 ms |
コード長 | 877 bytes |
コンパイル時間 | 875 ms |
コンパイル使用メモリ | 76,900 KB |
最終ジャッジ日時 | 2025-01-09 19:15:18 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 54 |
ソースコード
#include <iostream> #include <vector> #include <string> #include <tuple> void solve() { int n, m; std::cin >> n >> m; std::vector<std::string> ss(n); for (auto& s : ss) std::cin >> s; std::vector<std::pair<int, int>> ps; for (int x = 0; x < n; ++x) { for (int y = 0; y < m; ++y) { if (ss[x][y] == '*') ps.emplace_back(x, y); } } int x0, y0, x1, y1; std::tie(x0, y0) = ps[0]; std::tie(x1, y1) = ps[1]; if (x0 != x1 && y0 != y1) { ss[x0][y1] = '*'; } else if (x0 == x1) { int x = (x0 == 0 ? 1 : 0); ss[x][0] = '*'; } else { int y = (y0 == 0 ? 1 : 0); ss[0][y] = '*'; } for (auto& s : ss) { std::cout << s << std::endl; } } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }