Submission #55522380
Source Code Expand
//Problem link:
// Libraries
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set; //find_by_order, order_of_key
#include <ext/rope>
using namespace __gnu_cxx;
// Data types
typedef string str;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef unsigned int ui;
typedef unsigned long long ull;
// Methods
#define MP make_pair
#define F first
#define S second
#define PB push_back
#define sz(a) (int)(a).size()
// Iterator
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
// Variable names
#define y1 y1___
// Loops
#define FOR(i,a,b) for (int i = (a); i <= (b); ++i)
#define RFOR(i,a,b) for (int i = (a); i >= (b); --i)
// Constant variables
const int MOD = 1000000007; // 998244353
const int INF = 2000000005;
const ll LLINF = 1000000000000000005LL;
const ld PI = acos((ld)-1);
const ld EPS = 1e-9;
void setIO(str name="") {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout << setprecision(15) << fixed;
if (fopen((name + ".INP").c_str(), "r")) {
freopen((name + ".INP").c_str(), "r", stdin);
freopen((name + ".OUT").c_str(), "w", stdout);
}
}
inline ll pw(ll bs, ll p, int mod=MOD) {
ll res = 1;
ll tmp = bs;
while (p) {
if (p & 1) {
res = res*tmp%mod;
}
tmp = tmp*tmp%mod;
p >>= 1;
}
return res;
}
inline ll inv(ll x, int mod=MOD) {
return pw(x, mod-2, mod);
}
#if __cplusplus >= 201103L
mt19937_64 rd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif // __cplusplus
int test = 1;
const int MAXN = 0;
template<class T> struct Point {
T x, y;
Point() : x(0), y(0) {};
Point(const T& _x, const T& _y) : x(_x), y(_y) {};
Point(const Point<T>& p) : x(p.x), y(p.y) {};
Point<T> operator+ (const Point<T>& b) {
Point<T> &a = *this;
return Point<T>(a.x + b.x, a.y + b.y);
}
Point<T>& operator+= (const Point<T> &b) {
x += b.x;
y += b.y;
return *this;
}
Point<T> operator- (const Point<T> &b) {
Point<T> &a = *this;
return Point<T>(a.x - b.x, a.y - b.y);
}
Point<T>& operator-= (const Point<T> &b) {
x -= b.x;
y -= b.y;
return *this;
}
Point<T> operator* (const T& k) {
return Point<T>(x*k, y*k);
}
Point<T>& operator*= (const T& k) {
x *= k;
y *= k;
return *this;
}
Point<T> operator/ (const T& k) {
return Point<T>(x/k, y/k);
}
Point<T>& operator/= (const T& k) {
x /= k;
y /= k;
return *this;
}
friend T operator* (const Point<T> &a, const Point<T> &b) {
return a.x * b.x + a.y * b.y;
}
T operator^ (const Point<T> &b) {
Point<T> &a = *this;
return a.x * b.y - a.y * b.x;
}
friend ostream& operator<< (ostream& os, const Point<T> &p) {
return os << p.x << ' ' << p.y;
}
friend T norm(const Point<T> &p) {
return p * p;
}
friend ld abs(const Point<T> &p) {
return sqrt((ld)(p * p));
}
friend ld proj(const Point<T> &a, const Point<T> &b) {
return (a * b) / abs(b);
}
friend ld arg(const Point<T> &p) {
return atan2((ld)p.y, (ld)p.x);
}
friend ld angle(const Point<T> &a, const Point<T> &b) {
return remainder(arg(b) - arg(a), 2*PI);
}
friend ld angle(const Point<T> &a, const Point<T> &b, const Point<T> &c) {
return remainder(arg(c - b) - arg(a - b), 2*PI);
}
friend Point<ld> mypolar(const T& r, const ld& theta) {
return Point<ld>(r * cos(theta), r * sin(theta));
}
friend Point<T> scale(const Point<T>& p, const Point<T> &c, const T& k) {
return c + (p - c)*k;
}
friend Point<ld> rot(const Point<T>& p, const ld& theta) {
return Point<ld>(p.x * cos(theta) - p.y * sin(theta), p.x * sin(theta) + p.y * cos(theta));
}
friend Point<ld> rot(const Point<T>& p, const Point<T> &c, const ld& theta) {
return rot(p - c, theta) + c;
}
friend Point<T> perp(const Point<T> &p) {
return Point<T>(-p.y, p.x);
}
friend T orient(const Point<T> &a, const Point<T> &b, const Point<T> &c) {
return (b - a) ^ (c - a);
}
friend bool inAngle(const Point<T> &a, const Point<T> &b, const Point<T> &c, const Point<T> &p) {
T tmp = orient(b, a, c);
if (tmp == 0) return orient(b, a, p) == 0;
if (tmp > 0) {
return orient(b, a, p) >= 0 && orient(b, c, p) <= 0;
} else {
return orient(b, a, p) <= 0 && orient(b, c, p) >= 0;
}
}
};
template<class T> bool half(const Point<T>& p) {
assert(p.x != 0 || p.y != 0);
return (p.y > 0 || (p.y == 0 && p.x < 0));
}
template<class T, class IT> void polarSort(IT st, IT en) {
sort(st, en, [](const Point<T>& p, const Point<T>& q){
return make_tuple(half(p), 0, norm(p)) < make_tuple(half(q), p ^ q, norm(q));
});
}
Point<int> p[3];
void solve() {
FOR(i, 0, 2) {
cin >> p[i].x >> p[i].y;
}
if ((p[1]-p[0])*(p[2]-p[0]) == 0) {
cout << "Yes\n";
return;
} else if ((p[0]-p[1])*(p[2]-p[1]) == 0) {
cout << "Yes\n";
return;
} else if ((p[0]-p[2])*(p[1]-p[2]) == 0) {
cout << "Yes\n";
return;
}
cout << "No\n";
}
int main() {
setIO();
//cin >> test;
while (test--) {
solve();
}
return 0;
}
Submission Info
| Submission Time |
|
| Task |
B - Right Triangle |
| User |
Lilinta |
| Language |
C++ 20 (gcc 12.2) |
| Score |
200 |
| Code Size |
6008 Byte |
| Status |
AC |
| Exec Time |
1 ms |
| Memory |
3612 KiB |
Compile Error
Main.cpp: In function ‘void setIO(str)’:
Main.cpp:55:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
55 | freopen((name + ".INP").c_str(), "r", stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:56:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
56 | freopen((name + ".OUT").c_str(), "w", stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Judge Result
| Set Name |
Sample |
All |
| Score / Max Score |
0 / 0 |
200 / 200 |
| Status |
|
|
| Set Name |
Test Cases |
| Sample |
00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
| All |
00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 02_handmade_00.txt, 02_handmade_01.txt, 02_handmade_02.txt, 02_handmade_03.txt, 02_handmade_04.txt |
| Case Name |
Status |
Exec Time |
Memory |
| 00_sample_00.txt |
AC |
1 ms |
3460 KiB |
| 00_sample_01.txt |
AC |
1 ms |
3608 KiB |
| 00_sample_02.txt |
AC |
1 ms |
3608 KiB |
| 01_random_00.txt |
AC |
1 ms |
3460 KiB |
| 01_random_01.txt |
AC |
1 ms |
3484 KiB |
| 01_random_02.txt |
AC |
1 ms |
3476 KiB |
| 01_random_03.txt |
AC |
1 ms |
3472 KiB |
| 01_random_04.txt |
AC |
1 ms |
3480 KiB |
| 01_random_05.txt |
AC |
1 ms |
3324 KiB |
| 01_random_06.txt |
AC |
1 ms |
3480 KiB |
| 01_random_07.txt |
AC |
1 ms |
3476 KiB |
| 01_random_08.txt |
AC |
1 ms |
3476 KiB |
| 01_random_09.txt |
AC |
1 ms |
3452 KiB |
| 01_random_10.txt |
AC |
1 ms |
3612 KiB |
| 01_random_11.txt |
AC |
1 ms |
3324 KiB |
| 01_random_12.txt |
AC |
1 ms |
3608 KiB |
| 01_random_13.txt |
AC |
1 ms |
3436 KiB |
| 01_random_14.txt |
AC |
1 ms |
3456 KiB |
| 01_random_15.txt |
AC |
1 ms |
3384 KiB |
| 02_handmade_00.txt |
AC |
1 ms |
3320 KiB |
| 02_handmade_01.txt |
AC |
1 ms |
3464 KiB |
| 02_handmade_02.txt |
AC |
1 ms |
3476 KiB |
| 02_handmade_03.txt |
AC |
1 ms |
3552 KiB |
| 02_handmade_04.txt |
AC |
1 ms |
3484 KiB |