結果
問題 | No.455 冬の大三角 |
ユーザー |
![]() |
提出日時 | 2018-03-03 19:57:19 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,190 bytes |
コンパイル時間 | 782 ms |
コンパイル使用メモリ | 86,476 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-30 04:45:03 |
合計ジャッジ時間 | 2,873 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 54 |
ソースコード
#include <iostream>#include <vector>#include <string>#include <cstring>#include <math.h>#include <cmath>#include <limits.h>#include <map>#include <set>#include <queue>#include <algorithm>#include <functional>#include <stdio.h>using namespace std;long long MOD = 1000000007;struct Point {Point(){};Point( int a, int b ){ x = a; y = b; };int x;int y;};bool isOK( Point p1, Point p2, Point p3 ) {return !(abs(p1.x-p2.x)*abs(p2.y-p3.y) == abs(p2.x-p3.x)*abs(p1.y-p2.y));}int main() {int H,W;cin >> H >> W;vector<string> V(H);for ( int i = 0; i < H; i++ ) {cin >> V[i];}Point P[2];int a = 0;for ( int y = 0; y < H; y++ ) {for ( int x = 0; x < W; x++ ) {if ( V[y][x] == '*' ) {Point p(x,y);P[a] = p;a++;}}}Point p;for ( int y = 0; y < H; y++ ) {for ( int x = 0; x < W; x++ ) {p.x = x; p.y = y;if ( isOK(p,P[0],P[1]) ) {V[y][x] = '*';goto ok;}}}ok:for ( int y = 0; y < H; y++ ) {cout << V[y] << endl;}return 0;}