結果
| 問題 | No.199 星を描こう |
| コンテスト | |
| ユーザー |
n_vip
|
| 提出日時 | 2015-04-28 23:46:53 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 2,236 bytes |
| コンパイル時間 | 1,226 ms |
| コンパイル使用メモリ | 98,468 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-30 03:01:36 |
| 合計ジャッジ時間 | 2,192 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y-1);(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
#define Re real()
#define Im imag()
typedef complex<int> P;
typedef pair<P,P> L; //sX+tY
const double EPS=1e-5;
double dot(P a,P b){return (conj(a)*b).real();}
double cros(P a,P b){return (conj(a)*b).imag();}
int ccw(P a,P b,P c){
b-=a; c-=a;
//cout<<cros(b,c)<<endl;
if(cros(b,c) > EPS) return +1;//ccw
if(cros(b,c) < -EPS) return -1;//cw
if(dot(b,c) < -EPS) return +2; //c-a-b
if(dot(b,c) > EPS) return -2; //a-b-c or a-c-b
return 0;
}
int main(){
ios_base::sync_with_stdio(false);
cout<<fixed<<setprecision(0);
int i,j,k,flg=0,f=1;
double x,y;
vector<P> v(5);
rep(i,5){
cin>>x>>y;
v[i]=P(x,y);
}
vector<int> w(5);
iota(all(w),0);
do{
f=1;
rep(i,5)rep(j,2){
int a=ccw(v[w[(i+2+j)%5]],v[w[(i+3+j)%5]],v[w[i]]),
b=ccw(v[w[(i+2+j)%5]],v[w[(i+3+j)%5]],v[w[(i+1)%5]]);
// if(w==vector<int>{0,3,2,1,4},0)cout<<a<<","<<b<<endl;
if(abs(a)!=1 || abs(b)!=1)
f=0;
if(a==b)
f=0;
}
flg|=f;
if(f,0)
cout<<w<<endl;
}while(next_permutation(all(w)));
cout<<(flg?"YES":"NO")<<endl;
//cout<<ccw(P(0,-1),P(0,1),P(0,0))<<endl;
return 0;
}
n_vip