結果

問題 No.199 星を描こう
ユーザー niyarinniyarin
提出日時 2016-11-15 18:07:25
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 2,291 bytes
コンパイル時間 428 ms
コンパイル使用メモリ 6,712 KB
実行使用メモリ 6,064 KB
最終ジャッジ日時 2023-08-17 07:05:20
合計ジャッジ時間 2,267 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
5,960 KB
testcase_01 AC 10 ms
6,064 KB
testcase_02 AC 10 ms
6,020 KB
testcase_03 AC 11 ms
5,936 KB
testcase_04 AC 12 ms
5,856 KB
testcase_05 AC 12 ms
5,936 KB
testcase_06 AC 12 ms
5,956 KB
testcase_07 AC 12 ms
6,032 KB
testcase_08 AC 11 ms
6,012 KB
testcase_09 AC 12 ms
5,880 KB
testcase_10 AC 15 ms
5,880 KB
testcase_11 AC 11 ms
5,940 KB
testcase_12 AC 12 ms
5,860 KB
testcase_13 AC 12 ms
5,992 KB
testcase_14 AC 10 ms
5,856 KB
testcase_15 AC 10 ms
5,932 KB
testcase_16 AC 10 ms
5,864 KB
testcase_17 AC 10 ms
5,996 KB
testcase_18 AC 10 ms
6,044 KB
testcase_19 AC 10 ms
5,932 KB
testcase_20 WA -
testcase_21 AC 11 ms
5,936 KB
testcase_22 AC 10 ms
6,020 KB
testcase_23 AC 10 ms
5,996 KB
testcase_24 AC 12 ms
6,008 KB
testcase_25 AC 12 ms
5,944 KB
testcase_26 AC 11 ms
5,944 KB
testcase_27 AC 10 ms
6,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

dots = [map(int,raw_input().split(" ")) for i in range(5)]

def nyrn():
    for i in range(5):
        for j in range(i+1,5):
            for k in range(j+1,5):
                f1 = dots[i][1]-dots[j][1] == 0 
                f2 = dots[i][1]-dots[k][1] == 0 
                
                if f1 == f2 and f1:
                    return 0
                if f1 or f2:
                    continue
                if float(dots[i][0]-dots[j][0])/ (dots[i][1]-dots[j][1]) == float(dots[i][0]-dots[k][0])/(dots[i][1]-dots[k][1]):
                    return 0
    return 1



def nyrnx(ax, ay, bx, by, cx, cy, dx, dy):
  ta = (cx - dx) * (ay - cy) + (cy - dy) * (cx - ax);
  tb = (cx - dx) * (by - cy) + (cy - dy) * (cx - bx);
  tc = (ax - bx) * (cy - ay) + (ay - by) * (ax - cx);
  td = (ax - bx) * (dy - ay) + (ay - by) * (ax - dx);
  return tc * td < 0 and ta * tb < 0;




def nyrn2():
    for i in range(5):
        for j in range(5):
            for k in range(5):
                for l in range(5):
                    for m in range(5):
                        if len(set([i,j,k,l,m])) == 5:
                            v = [i,j,k,l,m]*2
                            flag = True
                            for n in range(1,6):
                                a = v[n-1]
                                b = v[n]
                                c = v[n+1]

                                if ((dots[b][0]-dots[a][0])*(dots[b][0]-dots[c][0]) + (dots[b][1]-dots[a][1])*(dots[b][1]-dots[c][1]))<0:
                                    flag = False
                                    break
                                
                                out = []
                                for o in range(5):
                                    if o != a and o!= b and o!=c:
                                        out.append(dots[o])

                                if not nyrnx(out[0][0],out[0][1],out[1][0],out[1][1],dots[b][0],dots[b][1],dots[a][0],dots[a][1]):
                                    flag = False
                                    break
                            

                            if flag:

                                return 1
    return 0




                                

print "YES" if (nyrn() and nyrn2()) else "NO"


                


0