結果

問題 No.455 冬の大三角
ユーザー はむこ
提出日時 2016-12-05 02:27:10
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 842 bytes
コンパイル時間 1,177 ms
コンパイル使用メモリ 165,708 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-11 16:54:57
合計ジャッジ時間 3,243 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 53 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <time.h>
#include <sys/time.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);

    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));
    }

    while (1) {
        ll ah = rand() % h;
        ll aw = rand() % w;
        star.push_back(P(ah, aw));
        if ((star[1].first - star[0].first) * (star[2].second - star[0].second) - (star[2].first - star[0].first) * (star[2].second - star[0].second)) {
            b[ah][aw] = '*';
            rep(i, h) cout << b[i] << endl;
            return 0;
        }
        star.pop_back();
    }

    return 0;
}
0