結果
問題 |
No.3005 トレミーの問題
|
ユーザー |
👑 ![]() |
提出日時 | 2025-01-17 21:33:53 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,082 bytes |
コンパイル時間 | 818 ms |
コンパイル使用メモリ | 74,872 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2025-01-17 21:34:12 |
合計ジャッジ時間 | 1,598 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
#ifdef NACHIA #define _GLIBCXX_DEBUG #else #define NDEBUG #endif #include <iostream> #include <string> #include <vector> #include <algorithm> using i64 = long long; using u64 = unsigned long long; #define rep(i,n) for(int i=0; i<int(n); i++) const i64 INF = 1001001001001001001; template<typename A> void chmin(A& l, const A& r){ if(r < l) l = r; } template<typename A> void chmax(A& l, const A& r){ if(l < r) l = r; } using namespace std; #include <atcoder/modint> using Modint = atcoder::static_modint<998244353>; void testcase(){ i64 a[3], b[3], c[3] = {}; i64 X[4][2] = {}; rep(i,4) rep(j,2) cin >> X[i][j]; rep(i,3) a[i] = X[i][0] - X[3][0]; rep(i,3) b[i] = X[i][1] - X[3][1]; rep(i,3) c[i] = a[i] * a[i] + b[i] * b[i]; i64 det = 0; rep(i,3){ det += a[(i+0)%3] * b[(i+1)%3] * c[(i+2)%3]; det -= a[(i+0)%3] * b[(i+2)%3] * c[(i+1)%3]; } if(a[0] * b[1] - a[1] * b[0] == 0) det = 1; cout << (det == 0 ? "YES\n" : "NO\n"); } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); testcase(); return 0; }