結果
| 問題 |
No.455 冬の大三角
|
| コンテスト | |
| ユーザー |
femto
|
| 提出日時 | 2016-12-09 15:15:48 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 756 bytes |
| コンパイル時間 | 1,569 ms |
| コンパイル使用メモリ | 171,928 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-29 21:35:11 |
| 合計ジャッジ時間 | 3,518 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 54 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int cross(P p1, P p2) {
return p1.first * p2.second - p1.second * p2.first;
}
string b[100];
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int H, W;
cin >> H >> W;
vector<P> p;
for(int y = 0; y < H; y++) {
cin >> b[y];
for(int x = 0; x < W; x++) {
if(b[y][x] == '*') p.push_back(P(x, y));
}
}
bool ok = false;
for(int y = 0; y < H; y++) {
for(int x = 0; x < W; x++) {
if(!ok && b[y][x] == '-') {
P p1(p[0].first - x, p[0].second - y);
P p2(p[1].first - x, p[1].second - y);
if(cross(p1, p2) != 0) {
b[y][x] = '*';
ok = true;
}
}
}
}
for(int y = 0; y < H; y++) {
cout << b[y] << endl;
}
}
femto