結果

問題 No.455 冬の大三角
ユーザー ngtkana
提出日時 2020-03-18 11:44:42
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 974 bytes
コンパイル時間 2,922 ms
コンパイル使用メモリ 200,776 KB
最終ジャッジ日時 2025-01-09 07:37:22
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using lint=long long;
int main(){
    std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
    std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
    lint h,w;std::cin>>h>>w;
    std::vector<std::vector<char>>g(h,std::vector<char>(w));
    std::vector<std::pair<lint,lint>>a;
    for(lint i=0;i<h;i++){
        for(lint j=0;j<w;j++){
            std::cin>>g.at(i).at(j);
            if(g.at(i).at(j)=='*')a.emplace_back(i,j);
        }
    }
    lint i0,j0,i1,j1;
    std::tie(i0,j0)=a.at(0);
    std::tie(i1,j1)=a.at(1);
    for(lint i=0;i<h;i++){
        bool found=false;
        for(lint j=0;j<w;j++){
            if((i0-i)*(j1-j)!=(i1-i)*(j0-j)){
                g.at(i).at(j)='*';
                found=true;
                break;
            }
        }
        if(found)break;
    }
    for(lint i=0;i<h;i++){
        for(lint j=0;j<w;j++){
            std::cout<<g.at(i).at(j);
        }
        std::cout<<'\n';
    }
}
0