結果
| 問題 | No.2564 衝突予測 |
| コンテスト | |
| ユーザー |
Tatsu_mr
|
| 提出日時 | 2024-09-18 04:07:00 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 244 ms / 2,000 ms |
| + 759µs | |
| コード長 | 945 bytes |
| 記録 | |
| コンパイル時間 | 2,297 ms |
| コンパイル使用メモリ | 340,680 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-08-30 00:26:41 |
| 合計ジャッジ時間 | 7,356 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ld = long double;
using P = pair<ld, ld>;
int main() {
int t;
cin >> t;
auto calc = [&](P p, P q, P r, P s) {
auto [a, c] = p;
auto [b, d] = q;
auto [e, g] = r;
auto [f, h] = s;
if (b == f && d == h) {
return a == e && c == g;
} else if (b == f) {
return a == e && (c - g) / (h - d) > 0;
} else if (d == h) {
return c == g && (a - e) / (f - b) > 0;
} else {
return (a - e) / (f - b) > 0 && ((a - e) / (f - b)) == ((c - g) / (h - d));
}
};
map<char, P> mp;
mp['R'] = {1, 0};
mp['L'] = {-1, 0};
mp['U'] = {0, 1};
mp['D'] = {0, -1};
while (t--) {
ld x1, y1, x2, y2;
char d1, d2;
cin >> x1 >> y1 >> d1 >> x2 >> y2 >> d2;
cout << (calc({x1, y1}, mp[d1], {x2, y2}, mp[d2]) ? "Yes" : "No") << endl;
}
}
Tatsu_mr