結果

問題 No.455 冬の大三角
コンテスト
ユーザー ei1333333
提出日時 2016-12-08 21:01:57
言語 C++11
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
+ 447µs
コード長 679 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,140 ms
コンパイル使用メモリ 179,268 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2026-08-02 00:08:21
合計ジャッジ時間 3,764 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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