結果

問題 No.455 冬の大三角
ユーザー aaaaaaiu
提出日時 2019-08-17 14:18:21
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 760 bytes
コンパイル時間 1,784 ms
コンパイル使用メモリ 196,348 KB
最終ジャッジ日時 2025-01-07 13:23:52
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    int h,w;
    cin>>h>>w;
    string s[h];
    vector<int> sx,sy;
    for (int i=0;i<h;i++) {
        cin>>s[i];
        for (int j=0;j<w;j++)
            if (s[i][j]=='*') {
                sx.push_back(j);
                sy.push_back(i);
            }
    }
    for (int i=0;i<h;i++)
        for (int j=0;j<w;j++)
            if (s[i][j]=='-') {
                int a,b,c,d;
                a=j-sx[0];
                b=i-sy[0];
                c=j-sx[1];
                d=i-sy[1];
                if (a*d-b*c!=0) {
                    s[i][j]='*';
                    goto aaa;
                }
            }
    aaa:;
    for (string b:s) cout<<b<<endl;
    return 0;
}
0