結果
| 問題 |
No.455 冬の大三角
|
| コンテスト | |
| ユーザー |
beet
|
| 提出日時 | 2018-07-30 12:02:07 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 805 bytes |
| コンパイル時間 | 1,715 ms |
| コンパイル使用メモリ | 169,356 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-13 15:21:03 |
| 合計ジャッジ時間 | 4,127 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 54 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
Int h,w;
cin>>h>>w;
vector<string> s(h);
for(Int i=0;i<h;i++) cin>>s[i];
auto cross=[](Int a,Int b,Int c,Int d){return a*d-b*c;};
auto check=
[&](){
Int xs[3],ys[3],c=0;
for(Int i=0;i<h;i++)
for(Int j=0;j<w;j++)
if(s[i][j]=='*') ys[c]=i,xs[c]=j,c++;
Int dx1=xs[1]-xs[0],dx2=xs[2]-xs[1];
Int dy1=ys[1]-ys[0],dy2=ys[2]-ys[1];
//cout<<dx1<<" "<<dy1<<":"<<dx2<<" "<<dy2<<endl;
//cout<<cross(dx1,dy1,dx2,dy2)<<endl;
if(cross(dx1,dy1,dx2,dy2)==0) return;
for(Int i=0;i<h;i++) cout<<s[i]<<endl;
exit(0);
};
for(Int i=0;i<h;i++)
for(Int j=0;j<w;j++)
if(s[i][j]=='-') s[i][j]='*',check(),s[i][j]='-';
return 0;
}
beet