結果
| 問題 | No.199 星を描こう |
| コンテスト | |
| ユーザー |
はまやんはまやん
|
| 提出日時 | 2016-06-11 16:28:34 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 1,194 bytes |
| コンパイル時間 | 2,124 ms |
| コンパイル使用メモリ | 174,356 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-30 03:49:43 |
| 合計ジャッジ時間 | 2,890 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
const double EPS = 1e-8;
const double INF = 1e12;
typedef complex<double> P;
namespace std {
bool operator < (const P& a, const P& b) {
return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
}
}
double cross(const P& a, const P& b) {
return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
return real(conj(a)*b);
}
struct L : public vector<P> {
L() {}
L(const P &a, const P &b) {
push_back(a); push_back(b);
}
};
typedef vector<P> G;
int main()
{
cin.tie(0);
ios::sync_with_stdio(false);
double x, y;
vector<P> ps(5);
while (cin >> x >> y)
{
ps[0] = P(x, y);
rep(i, 1, 5)
{
cin >> x >> y;
ps[i] = P(x, y);
}
sort(ps.begin(), ps.end());
string ans = "NO";
do
{
bool ok = true;
rep(i, 0, 5)
{
int s = i;
int t = (i + 1) % 5;
int cnt = 0;
rep(j, 0, 5) if (j != s && j != t)
{
if (cross(ps[t] - ps[s], ps[j] - ps[s]) < 0) cnt++;
}
if (cnt != 1) ok = false;
}
if (ok)
{
ans = "YES";
break;
}
} while (next_permutation(ps.begin(), ps.end()));
cout << ans << endl;
}
}
はまやんはまやん