結果

問題 No.455 冬の大三角
ユーザー はむこはむこ
提出日時 2016-12-05 00:49:44
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 705 bytes
コンパイル時間 1,786 ms
コンパイル使用メモリ 165,108 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-29 20:57:09
合計ジャッジ時間 4,048 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(long long i = 0; i < (long long)(n); i++)
using ll = long long;
using P = pair<ll, ll>;

int main(void) {
    ll h, w; cin >> h >> w; vector<string> b(h); 
    assert(h >= 2);
    assert(w >= 2);
    assert(h <= 100);
    assert(w <= 100);
    vector<P> star;
    rep(i, h) {
        cin >> b[i];
        assert(b[i].size() == w);
        rep(j, w) if (b[i][j] == '*') star.push_back(P(i, j));
    }
    assert(star.size() == 2);
    assert(b.size() == h);
    ((star[0].first == star[1].first) ? b[(star[0].first+1)%h][star[0].second] : b[star[0].first][(star[0].second+1)%w]) = '*';
    rep(i, h) cout << b[i] << endl;

    return 0;
}
0