結果
問題 | No.199 星を描こう |
ユーザー |
|
提出日時 | 2015-04-29 00:09:00 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,628 bytes |
コンパイル時間 | 1,536 ms |
コンパイル使用メモリ | 163,144 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-05 05:20:41 |
合計ジャッジ時間 | 2,351 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 WA * 7 |
ソースコード
#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],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; }