結果
| 問題 |
No.199 星を描こう
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-04-29 23:56:28 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,660 bytes |
| コンパイル時間 | 1,604 ms |
| コンパイル使用メモリ | 164,824 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-30 03:33:38 |
| 合計ジャッジ時間 | 2,658 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
#define pb(a) push_back(a)
#define pr(a) cout<<(a)<<endl
#define PR(a,b) cout<<(a)<<" "<<(b)<<endl
#define R cin>>
#define F first
#define S second
#define ll long long
bool check(int n,int m,int x,int y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<60,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef complex<double> P;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
namespace std {
bool operator < (const P& a, const P& b){
return fabs(real(a)-real(b)) < EPS ? imag(a) < imag(b) : real(a) < real(b);
}
}
double dot(P a, P b){ return real(conj(a)*b); }
double cross(P a, P b){ return imag(conj(a)*b); }
int ccw(P a, P b, P c){
b -= a;
c -= a;
if(cross(b,c) > EPS) return 1;
if(cross(b,c) < -EPS) return -1;
if(dot(b,c) < -EPS) return 2;
if(norm(b) < norm(c)) return -2;
return 0;
}
int main() {
bool ck=false;
P p[5];
rep(i,5) {
int x,y;
cin >> x >> y;
p[i]=P(x,y);
}
sort(p,p+5);
do {
bool ck2=true;
rep(i,5) {
int c=0,c2=0;
rep(j,5) {
if(j==i || j==(i+1)%5) continue;
int t=ccw(p[i],p[(i+1)%5],p[j]);
if(t==1) c++;
if(t==-1) c2++;
}
if(c!=1 || c2!=2) ck2=false;
}
if(ck2) ck=true;
} while(next_permutation(p,p+5));
if(ck) cout << "YES" << endl;
else cout << "NO" << endl;
return 0;
}