結果
問題 | No.455 冬の大三角 |
ユーザー |
![]() |
提出日時 | 2017-05-18 08:36:00 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 819 bytes |
コンパイル時間 | 908 ms |
コンパイル使用メモリ | 111,352 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-30 01:15:24 |
合計ジャッジ時間 | 3,004 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 54 |
ソースコード
#include <cstdio>#include <cstring>#include <random>#include <vector>#include <algorithm>#include <array>#include <functional>#include <utility>#include <regex>using namespace std;int main(){int h,w;-scanf("%d%d",&h,&w);vector<string> s(h);for(int i=0;i<h;i++){char t[128];-scanf("%s",t);s[i]=t;}array<int,2> a={-1,-1},b={-1,-1};for(int y=0;y<h;y++){for(int x=0;x<w;x++){if(s[y][x]=='*'){if(a[0]==-1){a[0]=x;a[1]=y;}else{b[0]=x;b[1]=y;}}}}int dx1=a[0]-b[0],dy1=a[1]-b[1];for(int y=0;y<h;y++){for(int x=0;x<w;x++){if(s[y][x]=='-'){int dx2=x-b[0],dy2=y-b[1];int ret=dx1*dy2-dx2*dy1;if(ret){s[y][x]='*';for(auto a:s){puts(a.c_str());}return 0;}}}}return 0;}