結果
問題 | No.455 冬の大三角 |
ユーザー |
![]() |
提出日時 | 2018-02-20 21:22:30 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,265 bytes |
コンパイル時間 | 1,704 ms |
コンパイル使用メモリ | 173,400 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-30 04:32:56 |
合計ジャッジ時間 | 3,237 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 54 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define fst(t) std::get<0>(t)#define snd(t) std::get<1>(t)#define thd(t) std::get<2>(t)#define unless(p) if(!(p))#define until(p) while(!(p))using ll = long long;using P = std::tuple<int,int>;const int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}, dy[8] = {0, 0, -1, 1, -1, 1, -1, 1};string sky[110];int cross(int x1, int y1, int x2, int y2){return x1 * y2 - x2 * y1;}int main(){std::cin.tie(nullptr);std::ios::sync_with_stdio(false);int H, W;std::cin >> H >> W;vector<P> stars;for(int i=0;i<H;++i){std::cin >> sky[i];for(int j=0;j<W;++j){if(sky[i][j] == '*'){stars.emplace_back(i, j);}}}bool ok = false;for(int i=0;i<H&&!ok;++i){for(int j=0;j<W;++j){if(sky[i][j] == '*'){continue;}int c = cross(fst(stars[0]) - i, snd(stars[0]) - j, fst(stars[1]) - i, snd(stars[1]) - j);if(c == 0){continue;}sky[i][j] = '*';ok = true;break;}}for(int i=0;i<H;++i){std::cout << sky[i] << std::endl;}}