結果
| 問題 | No.199 星を描こう |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-08-12 15:23:55 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,360 bytes |
| コンパイル時間 | 1,780 ms |
| コンパイル使用メモリ | 165,488 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-30 03:38:22 |
| 合計ジャッジ時間 | 2,508 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include <bits/stdc++.h>
#define rep(i, a) for (int i = 0; i < (a); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); i++)
#define repr(i, a) for (int i = (a) - 1; i >= 0; i--)
#define repr2(i, a, b) for (int i = (b) - 1; i >= (a); i--)
using namespace std;
typedef long long ll;
const ll inf = 1e9;
const ll mod = 1e9 + 7;
typedef ll D;
typedef complex<D> P;
const D eps = 0;
D dot(P a, P b) {
return real(conj(a) * b);
}
D cross(P a, P b) {
return imag(conj(a) * b);
}
bool comp(P a, P b) {
if (a.real() != b.real()) return a.real() < b.real();
return a.imag() < b.imag();
}
vector<P> convex_full(vector<P> &ps) {
int n = ps.size();
sort(ps.begin(), ps.end(), comp);
int k = 0;
vector<P> qs(n * 2);
for (int i = 0; i < n; i++) {
while (k > 1 && cross(qs[k - 1] - qs[k - 2], ps[i] - qs[k - 1]) <= 0) k--;
qs[k++] = ps[i];
}
for (int i = n - 2, t = k; i >= 0; i--) {
while (k > t && cross(qs[k - 1] - qs[k - 2], ps[i] - qs[k - 1]) <= 0) k--;
qs[k++] = ps[i];
}
qs.resize(k - 1);
return qs;
}
int main() {
vector<P> ps;
rep (i, 5) {
D x, y;
cin >> x >> y;
ps.emplace_back(x, y);
}
vector<P> cf = convex_full(ps);
if (cf.size() == 5) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
}