結果

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

ソースコード

diff #

#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <iostream>
#include <queue>
#include <list>
#include <stack>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;


int main(){
  ios::sync_with_stdio(false);
  int H, W;
  cin >> H >> W;
  vector<string> v;
  rep(i,H){
    string s;
    cin >> s;
    v.push_back(s);
  }

  vector< pair<int,int> > p;
  rep(i,H){
    rep(j,W){
      if(v[i][j]=='*'){
        p.push_back(make_pair(i,j));
      }
    }
  }

  if(v[p[0].first][p[1].second] != '*'){
    v[p[0].first][p[1].second] = '*';
  }
  else if(v[p[1].first][p[0].second] != '*'){
    v[p[1].first][p[0].second] = '*';
  }
  else{
    if(p[0].first == p[1].first){
      if(p[0].first == 0) v[1][0] = '*';
      else v[0][0] = '*';
    }
    else if(p[0].second == p[1].second){
      if(p[0].second == 0) v[0][1] = '*';
      else v[0][0] = '*';
    }
  }
  rep(i,H){
    rep(j,W){
      cout << v[i][j];
    }
    cout << endl;
  }
  
  return 0;
}

0