結果

問題 No.2628 Shrinkage
コンテスト
ユーザー shobonvip
提出日時 2026-07-29 19:54:37
言語 C++23
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 1,897 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,377 ms
コンパイル使用メモリ 374,244 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2026-07-29 19:54:43
合計ジャッジ時間 5,758 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1 WA * 27
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

/**
	author:  shobonvip
	created: 2026.07.29 19:49:23
**/

#include<bits/stdc++.h>
using namespace std;

//* ATCODER
#include<atcoder/all>
using namespace atcoder;
typedef modint998244353 mint;
//*/

/* BOOST MULTIPRECISION
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
//*/

typedef long long ll;

#define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
#define rrep(i, s, n) for (int i = (int)(n)-1; i >= (int)(s); i--)
#define all(v) v.begin(), v.end()

template <typename T> bool chmin(T &a, const T &b) {
	if (a <= b) return false;
	a = b;
	return true;
}

template <typename T> bool chmax(T &a, const T &b) {
	if (a >= b) return false;
	a = b;
	return true;
}

template <typename T> T max(vector<T> &a){
	assert(!a.empty());
	T ret = a[0];
	for (int i=0; i<(int)a.size(); i++) chmax(ret, a[i]);
	return ret;
}

template <typename T> T min(vector<T> &a){
	assert(!a.empty());
	T ret = a[0];
	for (int i=0; i<(int)a.size(); i++) chmin(ret, a[i]);
	return ret;
}

template <typename T> T sum(vector<T> &a){
	T ret = 0;
	for (int i=0; i<(int)a.size(); i++) ret += a[i];
	return ret;
}

void YES() {
	cout << "Yes\n";
}

void NO() {
	cout << "No\n";
}

ll dist2(ll x1, ll y1, ll x2, ll y2) {
	return (x1 - y1) * (x1 - y1) + (x2 - y2) * (x2 - y2);
}

void solve() {
	ll x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	ll a1, b1, a2, b2;
	cin >> a1 >> b1 >> a2 >> b2;

	if (pair(x1, y1) == pair(a1, b1) && pair(x2, y2) == pair(a2, y2)) {
		YES();
		return;
	}

	if (dist2(x1, y1, x2, y2) <= dist2(a1, b1, a2, b2)) {
		NO();
		return;
	}

	ll xt = x2 - x1;
	ll yt = y2 - y1;

	ll at = a2 - a1;
	ll bt = b2 - b1;

	if (xt * at + yt * bt < 0) {
		NO();
		return;
	}

	if (xt * bt - yt * at == 0) {
		YES();
		return;
	} else {
		NO();
		return;
	}


}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int t; cin >> t;
	while (t--) solve();

}
0