結果

問題 No.455 冬の大三角
ユーザー imulanimulan
提出日時 2016-12-06 00:07:22
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 945 bytes
コンパイル時間 1,630 ms
コンパイル使用メモリ 168,136 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-29 21:01:42
合計ジャッジ時間 3,574 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

int main()
{
    int h,w;
    cin >>h >>w;
    vector<string> s(h);
    rep(i,h) cin >>s[i];

    int idx=0;
    int x[2],y[2];
    rep(i,h)rep(j,w)
    {
        if(s[i][j]=='*')
        {
            x[idx]=j;
            y[idx]=i;
            ++idx;
        }
    }

    int X=0,Y=0;
    if(x[0]==x[1])
    {
        if(x[0]==0) X=1;
    }
    else if(y[0]==y[1])
    {
        if(y[0]==0) Y=1;
    }
    else
    {
        X=x[0];
        rep(i,h)
        {
            if(s[i][x[0]]=='-')
            {
                Y=i;
                break;
            }
        }
    }

    s[Y][X]='*';
    rep(i,h) cout << s[i] << endl;
    return 0;
}
0