-
Notifications
You must be signed in to change notification settings - Fork 0
/
abc181_c.cpp
169 lines (162 loc) · 3.77 KB
/
abc181_c.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/*8<{==========~ BEGIN TEMPLATE ~============>8*/
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.cpp"
#else
#define dbg(...)
#endif
#define endl '\n'
#define fastio \
ios_base::sync_with_stdio(0); \
cin.tie(0);
#define all(j) j.begin(), j.end()
#define rall(j) j.rbegin(), j.rend()
#define len(j) (int)j.size()
#define rep(i, a, b) \
for (common_type_t<decltype(a), decltype(b)> \
i = (a); \
i < (b); i++)
#define rrep(i, a, b) \
for (common_type_t<decltype(a), decltype(b)> \
i = (a); \
i > (b); i--)
#define trav(xi, xs) for (auto &xi : xs)
#define rtrav(xi, xs) \
for (auto &xi : ranges::views::reverse(xs))
using ll = long long;
#define inte ll
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define emp emplace
#define ins insert
#define divc(a, b) ((a) + (b)-1ll) / (b)
using str = string;
using ull = unsigned long long;
using ld = long double;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using vll2d = vector<vll>;
using vi = vector<int>;
using vi2d = vector<vi>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vc = vector<char>;
using vs = vector<str>;
template <typename T, typename T2>
using umap = unordered_map<T, T2>;
template <typename T>
using pqmn =
priority_queue<T, vector<T>, greater<T>>;
template <typename T>
using pqmx = priority_queue<T, vector<T>>;
template <typename T, typename U>
inline bool chmax(T &a, U const &b) {
return (a < b ? a = b, 1 : 0);
}
template <typename T, typename U>
inline bool chmin(T &a, U const &b) {
return (a > b ? a = b, 1 : 0);
}
/*8<============~ END TEMPLATE ~============}>8*/
void run();
int32_t main() {
#ifndef LOCAL
fastio;
#endif
int T = 1;
//cin >> T;
rep(t, 0, T) {
dbg(t);
run();
}
}
/*8<
@Problems:
https://vjudge.net/problem/AtCoder-abc259_b
>8*/
template <class T>
int sgn(T x) {
return (x > 0) - (x < 0);
}
template <class T>
struct Point {
typedef Point P;
T x, y;
explicit Point(T x = 0, T y = 0) : x(x), y(y) {}
bool operator<(P p) const {
return tie(x, y) < tie(p.x, p.y);
}
bool operator==(P p) const {
return tie(x, y) == tie(p.x, p.y);
}
P operator+(P p) const {
return P(x + p.x, y + p.y);
}
P operator-(P p) const {
return P(x - p.x, y - p.y);
}
P operator*(T d) const {
return P(x * d, y * d);
}
P operator/(T d) const {
return P(x / d, y / d);
}
T dot(P p) const { return x * p.x + y * p.y; }
T cross(P p) const { return x * p.y - y * p.x; }
T cross(P a, P b) const {
return (a - *this).cross(b - *this);
}
T dist2() const { return x * x + y * y; }
double dist() const {
return sqrt((double)dist2());
}
// angle to x-axis in interval [-pi, pi]
double angle() const { return atan2(y, x); }
P unit() const {
return *this / dist();
} // makes dist()=1
P perp() const {
return P(-y, x);
} // rotates +90 degrees
P normal() const { return perp().unit(); }
// returns point rotated 'a' radians ccw around
// the origin
P rotate(double a) const {
return P(x * cos(a) - y * sin(a),
x * sin(a) + y * cos(a));
}
friend ostream& operator<<(ostream& os, P p) {
return os << "(" << p.x << "," << p.y << ")";
}
};
void run() {
int N;cin>>N;
vector<Point<int>> PS;
rep(i,0,N){
int x,y;
cin>>x>>y;
PS.eb(x,y);
}
bool ok=false;
rep(i,0,N){
rep(j,i+1,N){
rep(k,j+1,N){
auto c=PS[i].cross(PS[j],PS[k]);
dbg(c);
ok|=(c==0);
}
}
}
cout<<(ok?"Yes":"No")<<endl;
}
/*8<
AC, geometry
S>8*/