結果

問題 No.199 星を描こう
ユーザー n_vipn_vip
提出日時 2015-04-28 23:46:53
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 2,236 bytes
コンパイル時間 773 ms
コンパイル使用メモリ 99,428 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-28 18:23:58
合計ジャッジ時間 1,967 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0