結果

問題 No.455 冬の大三角
ユーザー ei1333333
提出日時 2016-12-08 21:01:57
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 679 bytes
コンパイル時間 2,515 ms
コンパイル使用メモリ 162,404 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-29 21:34:51
合計ジャッジ時間 3,563 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)

int main()
{
  int H, W;
  string S[100];
  vector< pair< int, int > > pt;

  cin >> H >> W;
  rep(i, H) {
    cin >> S[i];
    rep(j, W) if(S[i][j] == '*') pt.emplace_back(i, j);
  }

  if(pt[0].first == pt[1].first) {
    if(pt[0].first == 0) S[pt[0].first + 1][pt[0].second] = '*';
    else S[pt[0].first - 1][pt[0].second] = '*';
  } else if(pt[0].second == pt[1].second) {
    if(pt[0].second == 0) S[pt[0].first][pt[0].second + 1] = '*';
    else S[pt[0].first][pt[0].second - 1] = '*';
  } else {
    S[pt[0].first][pt[1].second] = '*';
  }

  rep(i, H) cout << S[i] << endl;

}
0