結果
| 問題 |
No.3005 トレミーの問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-01-17 22:12:20 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,216 bytes |
| コンパイル時間 | 5,808 ms |
| コンパイル使用メモリ | 331,924 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2025-01-17 22:12:35 |
| 合計ジャッジ時間 | 6,835 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using mint = atcoder::static_modint<998244353>;
//using mint = atcoder::static_modint<1000000007>;
using namespace std;
using namespace atcoder;
using ld = long double;
using ll = long long;
#define mp(a,b) make_pair(a,b)
#define rep(i,s,n) for(int i=s; i<n; i++)
const vector<int> dx{1,0,-1,0},dy{0,1,0,-1};
ll inner(pair<ll,ll>x,pair<ll,ll>y,pair<ll,ll>z){
return (x.first-z.first)*(y.first-z.first)+(x.second-z.second)*(y.second-z.second);
}
ll d(pair<ll,ll>x,pair<ll,ll>y){
return (x.first-y.first)*(x.first-y.first)+(x.second-y.second)*(x.second-y.second);
}
bool oneline(pair<ll,ll>x,pair<ll,ll>y,pair<ll,ll>z){
return (x.first-z.first)*(y.second-z.second)==(x.second-z.second)*(y.first-z.first);
}
int main(){
vector<pair<ll,ll>> A(4);
for(auto&[x,y]:A)cin >> x >> y;
bool t=false;
rep(i,0,4){
if(oneline(A[i],A[(i+1)%4],A[(i+2)%4])==true)t=true;
}
if(t){
cout << "NO";
return 0;
}
ll l=inner(A[0],A[1],A[2]);
ll r=inner(A[0],A[1],A[3]);
l*=l,r*=r;
l*=d(A[0],A[3]);
l*=d(A[1],A[3]);
r*=d(A[0],A[2]);
r*=d(A[1],A[2]);
if(l==r)cout << "YES";
else cout << "NO";
}