s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1 value | original_language stringclasses 11 values | filename_ext stringclasses 1 value | status stringclasses 1 value | cpu_time stringlengths 1 5 | memory stringlengths 1 7 | code_size stringlengths 1 6 | code stringlengths 1 539k |
|---|---|---|---|---|---|---|---|---|---|---|---|
s791435747 | p00012 | u018967850 | 1464272938 | Python | Python | py | Runtime Error | 0 | 0 | 374 | # coding: utf-8
# Here your code !
# coding: utf-8
import numpy as np
l = map(float, raw_input().split())
x1 = l[2]-l[0]
x2 = l[3]-l[1]
y1 = l[4]-l[0]
y2 = l[5]-l[1]
p1 = l[6]-l[0]
p2 = l[7]-l[1]
matrix_A = np.array([[x1,y1],[x2,y2]])
vector_p = np.array([p1,p2])
x = np.linalg.solve(matrix_A, vector_p)
if 0<abs(x[0])+abs(x[1])<1:
print "Yes"
else:
print "No" |
s890586663 | p00012 | u018967850 | 1464273308 | Python | Python | py | Runtime Error | 0 | 0 | 452 | i = 1
while True:
l = map(float, raw_input().split())
x1 = l[2]-l[0]
x2 = l[3]-l[1]
y1 = l[4]-l[0]
y2 = l[5]-l[1]
p1 = l[6]-l[0]
p2 = l[7]-l[1]
matrix_A = np.array([[x1,y1],[x2,y2]])
vector_p = np.array([p1,p2])
x = np.linalg.solve(matrix_A, vector_p)
if 0<abs(x[0])+abs(x[1])<1:
print "Yes"
else:
print "No"
if i > 100:
break
i += 1
|
s304881650 | p00012 | u358919705 | 1471861204 | Python | Python3 | py | Runtime Error | 0 | 0 | 506 | import math
while True:
try:
x1, y1, x2, y2, x3, y3, xp, yp = map(float, input().split())
except:
break
x = [x1, x2, x3, x1]
y = [y1, y2, y3, y1]
x = list(map(lambda i: i - xp, x))
y = list(map(lambda i: i - yp, y))
s = lambda a1, a2, b1, b2: abs(a1 * b2 - a2 * b1)
sum = sum(s(x[i], y[i], x[i + 1], y[i + 1]) for i in range(3))
S = s(x[1] - x[0], y[1] - y[0], x[2] - x[0], y[2] - y[0])
if sum == S:
print('YES')
else:
print('NO') |
s271136969 | p00012 | u607831289 | 1473132482 | Python | Python | py | Runtime Error | 0 | 0 | 386 | import sys
datasets = sys.stdin
def between(xa, xb, xp):
return xa < xp < xb or xb < xp < xa
for dataset in datasets:
x1, y1, x2, y2, x3, y3, xp, yp = map(float, dataset.split())
if between(x1, x2, xp) and beteen(y1, y2, yp) and between(x2, x3, xp) and between(y2, y3, yp) and between(x3, x1, xp) and between(y3, y1, yp):
print 'YES'
else:
print 'NO' |
s862672039 | p00012 | u607831289 | 1473133111 | Python | Python | py | Runtime Error | 0 | 0 | 386 | import sys
datasets = sys.stdin
def between(xa, xb, xp):
return xa < xp < xb or xb < xp < xa
for dataset in datasets:
x1, y1, x2, y2, x3, y3, xp, yp = map(float, dataset.split())
if between(x1, x2, xp) and beteen(y1, y2, yp) and between(x2, x3, xp) and between(y2, y3, yp) and between(x3, x1, xp) and between(y3, y1, yp):
print 'YES'
else:
print 'NO' |
s423219026 | p00012 | u922871577 | 1479281289 | Python | Python | py | Runtime Error | 0 | 0 | 474 | import sys
for line in sys.stdin:
x1, y1, x2, y2, x3, y3, xp, yp = map(float, raw_input().split())
AB = [x2-x1, y2-y1]
BP = [xp-x2, yp-y2]
BC = [x3-x2, y3-y2]
CP = [xp-x3, yp-y3]
CA = [x1-x3, y1-y3]
BP = [xp-x1, yp-y1]
c1 = AB[0] * BP[1] - AB[1] * BP[0]
c2 = BC[0] * CP[1] - BC[1] * CP[0]
c3 = CA[0] * AP[1] - CA[1] * AP[0]
if (c1>0 and c2>0 and c3>0) or (c1<0 and c2<0 and c3<0):
print 'YES'
else:
print 'NO' |
s050683345 | p00012 | u922871577 | 1479281315 | Python | Python | py | Runtime Error | 0 | 0 | 467 | import sys
for line in sys.stdin:
x1, y1, x2, y2, x3, y3, xp, yp = map(float, line.split())
AB = [x2-x1, y2-y1]
BP = [xp-x2, yp-y2]
BC = [x3-x2, y3-y2]
CP = [xp-x3, yp-y3]
CA = [x1-x3, y1-y3]
BP = [xp-x1, yp-y1]
c1 = AB[0] * BP[1] - AB[1] * BP[0]
c2 = BC[0] * CP[1] - BC[1] * CP[0]
c3 = CA[0] * AP[1] - CA[1] * AP[0]
if (c1>0 and c2>0 and c3>0) or (c1<0 and c2<0 and c3<0):
print 'YES'
else:
print 'NO' |
s205776151 | p00012 | u140201022 | 1482425956 | Python | Python3 | py | Runtime Error | 0 | 0 | 753 | #include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;
int main(){
double x1,y1,x2,y2,x3,y3,xp,yp;
while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp)!=EOF){
if (((x2-x1)*(y2-y3))-((y1-y3)*(x2-x3))>0 && ((x3-x2)*(y3-yp))-((y1-yp)*(x3-xp))>0) {
//if(((x2-x1)*(y2-yp)-(y2-y1)*(x2-xp)>0)&&((x3-x2)*(y3-yp)-(y3-y2)*(x3-xp)>0)&&((x1-x3)*(y1-yp)-(y1-y3)*(x1-xp)>0)){
printf("YES\n");
//}else if(((x2-x1)*(y2-yp)-(y2-y1)*(x2-xp)<0)&&((x3-x2)*(y3-yp)-(y3-y2)*(x3-xp)<0)&&((x1-x3)*(y1-yp)-(y1-y3)*(x1-xp)<0)){
// printf("YES\n");
}else{
printf("NO\n");
}
}
return 0;
} |
s915712620 | p00012 | u151242583 | 1494902708 | Python | Python3 | py | Runtime Error | 0 | 0 | 466 | import sys
lines = str(sys.stdin.read()).strip().split("\n")
for line in lines:
data = line.split(" ")
x1 = float(data[0])
y1 = float(data[1])
x2 = float(data[2])
y2 = float(data[3])
x3 = float(data[4])
y3 = float(data[5])
xp = float(data[6])
yp = float(data[7])
if xp > min(x1, x2, x3) and
xp < max(x1, x2, x3) and
yp > min(y1, y2, y3) and
yp < max(y1, y2, y3):
print("YES")
else:
print("NO") |
s567742821 | p00012 | u354053070 | 1501926604 | Python | Python3 | py | Runtime Error | 0 | 0 | 449 | import sys
def isleft(ox, oy, ax, ay, px, py):
oax, oay = ax - ox, ay - oy
opx, opy = px - ox, py - oy
if oax * opy > oay * opx:
return 1
else:
return 0
for line in sys.stdin:
x1, y1, x2, y2, x3, y3, xp, yp = map(float, line.split())
A, B, C, P = (x1, y1), (x2, y2), (x3, y3), (xp, yp)
if isleft(*A, *B, *P) == isleft(*B, *C, *P) == isleft(*C, *A, *P):
print("YES")
else:
print("NO") |
s566813078 | p00012 | u354053070 | 1501926970 | Python | Python3 | py | Runtime Error | 0 | 0 | 455 | import sys
def isleft(ox, oy, ax, ay, px, py):
oax, oay = ax - ox, ay - oy
opx, opy = px - ox, py - oy
if oax * opy > oay * opx:
return 1
else:
return 0
for line in sys.stdin:
x1, y1, x2, y2, x3, y3, xp, yp = list(map(float, line.split()))
A, B, C, P = (x1, y1), (x2, y2), (x3, y3), (xp, yp)
if isleft(*A, *B, *P) == isleft(*B, *C, *P) == isleft(*C, *A, *P):
print("YES")
else:
print("NO") |
s638306525 | p00012 | u498511622 | 1502063096 | Python | Python3 | py | Runtime Error | 0 | 0 | 124 | while True:
x1,y1,x2,y2,x3,y3,xp,yp=map(float,input().split())
if xp<0 or yp<0:
print('No')
else:
print('Yes') |
s090266901 | p00012 | u846136461 | 1513854337 | Python | Python | py | Runtime Error | 0 | 0 | 1054 | # coding: utf-8
def linecheck(x1, y1, x2, y2, xp, yp):
if yp - y1 > (xp - x1) * (y2 - y1) / (x2 - x1):
return 1
elif yp - y1 < (xp - x1) * (y2 - y1) / (x2 - x1):
return -1
while True:
try:
x1, y1, x2, y2, x3, y3, xp, yp = map(float, raw_input().split())
if x1 == x2:
if (x1 < xp and xp < x3) or (x1 > xp and xp > x3):
judge = -1
else:
judge = 1
judge *= linecheck(x1, y1, x3, y3, xp, yp) * linecheck(x2, y2, x3, y3, xp, yp)
elif x2 == x3:
if (x1 < xp and xp < x3) or (x1 > xp and xp > x3):
judge = -1
else:
judge = 1
judge *= linecheck(x1, y1, x2, y2, xp, yp) * linecheck(x1, y1, x3, y3, xp, yp)
elif x3 == x1:
if (x1 < xp and xp < x2) or (x1 > xp and xp > x2):
judge = -1
else:
judge = 1
judge *= linecheck(x1, y1, x2, y2, xp, yp) * linecheck(x2, y2, x3, y3, xp, yp)
else:
judge = linecheck(x1, y1, x2, y2, xp, yp) * linecheck(x1, y1, x3, y3, xp, yp) * linecheck(x2, y2, x3, y3, xp, yp)
if judge > 0:
print("YES")
elif judge < 0:
print("NO")
except EOFError:
break |
s217238355 | p00012 | u846136461 | 1513854494 | Python | Python | py | Runtime Error | 0 | 0 | 1051 | # coding: utf-8
def linecheck(x1, y1, x2, y2, xp, yp):
if yp - y1 > (xp - x1) * (y2 - y1) / (x2 - x1):
return 1
elif yp - y1 < (xp - x1) * (y2 - y1) / (x2 - x1):
return -1
while True:
try:
x1, y1, x2, y2, x3, y3, xp, yp = map(float, raw_input().split())
if x1 == x2:
if (x1 < xp and xp < x3) or (x1 > xp and xp > x3):
judge = -1
else:
judge = 1
judge *= linecheck(x1, y1, x3, y3, xp, yp) * linecheck(x2, y2, x3, y3, xp, yp)
elif x2 == x3:
if (x1 < xp and xp < x3) or (x1 > xp and xp > x3):
judge = -1
else:
judge = 1
judge *= linecheck(x1, y1, x2, y2, xp, yp) * linecheck(x1, y1, x3, y3, xp, yp)
elif x3 == x1:
if (x1 < xp and xp < x2) or (x1 > xp and xp > x2):
judge = -1
else:
judge = 1
judge *= linecheck(x1, y1, x2, y2, xp, yp) * linecheck(x2, y2, x3, y3, xp, yp)
else:
judge = linecheck(x1, y1, x2, y2, xp, yp) * linecheck(x1, y1, x3, y3, xp, yp) * linecheck(x2, y2, x3, y3, xp, yp)
if judge > 0:
print("YES")
elif judge < 0:
print("NO")
except EOFError:
break |
s014929142 | p00012 | u846136461 | 1513854779 | Python | Python | py | Runtime Error | 0 | 0 | 1037 | def linecheck(x1, y1, x2, y2, xp, yp):
if yp - y1 > (xp - x1) * (y2 - y1) / (x2 - x1):
return 1
elif yp - y1 < (xp - x1) * (y2 - y1) / (x2 - x1):
return -1
while True:
try:
x1, y1, x2, y2, x3, y3, xp, yp = map(float, raw_input().split())
if x1 == x2:
if (x1 < xp and xp < x3) or (x1 > xp and xp > x3):
judge = -1
else:
judge = 1
judge *= linecheck(x1, y1, x3, y3, xp, yp) * linecheck(x2, y2, x3, y3, xp, yp)
elif x2 == x3:
if (x1 < xp and xp < x3) or (x1 > xp and xp > x3):
judge = -1
else:
judge = 1
judge *= linecheck(x1, y1, x2, y2, xp, yp) * linecheck(x1, y1, x3, y3, xp, yp)
elif x3 == x1:
if (x1 < xp and xp < x2) or (x1 > xp and xp > x2):
judge = -1
else:
judge = 1
judge *= linecheck(x1, y1, x2, y2, xp, yp) * linecheck(x2, y2, x3, y3, xp, yp)
else:
judge = linecheck(x1, y1, x2, y2, xp, yp) * linecheck(x1, y1, x3, y3, xp, yp) * linecheck(x2, y2, x3, y3, xp, yp)
if judge > 0:
print("YES")
elif judge < 0:
print("NO")
except EOFError:
break |
s317999904 | p00012 | u764789069 | 1514996141 | Python | Python | py | Runtime Error | 0 | 0 | 595 | import numpy
while True:
try:
x1,y1,x2,y2,x3,y3,xp,yp=map(float,raw_input().split())
AB=numpy.array([x2-x1,y2-y1])
AP=numpy.array([xp-x1,yp-y1])
BC=numpy.array([x3-x2,y3-y2])
BP=numpy.array([xp-x2,yp-y2])
CA=numpy.array([x1-x3,y1-y3])
CP=numpy.array([xp-x3,yp-y3])
if (numpy.cross(AB,AP) < 0 and numpy.cross(BC,BP) < 0 and numpy.cross(CA,CP) < 0) or\
(numpy.cross(AB,AP) > 0 and numpy.cross(BC,BP) > 0 and numpy.cross(CA,CP) > 0):
print "YES"
else:
print "NO"
except:
break
|
s279950012 | p00012 | u024715419 | 1515130480 | Python | Python3 | py | Runtime Error | 0 | 0 | 417 | import numpy
while True:
try:
x1, y1, x2, y2, x3, y3, xp, yp = map(float, input().split())
s1 = (x2-x1)*(yp-y1) - (y2-y1)*(xp-x1)
s2 = (x3-x2)*(yp-y2) - (y3-y2)*(xp-x2)
s3 = (x1-x3)*(yp-y3) - (y1-y3)*(xp-x3)
if numpy.sign(s1) == numpy.sign(s2) and numpy.sign(s1) == numpy.sign(s3):
print("YES")
else:
print("NO")
except:
break
|
s437718869 | p00012 | u024715419 | 1515130509 | Python | Python3 | py | Runtime Error | 0 | 0 | 417 | import numpy
while True:
try:
x1, y1, x2, y2, x3, y3, xp, yp = map(float, input().split())
s1 = (x2-x1)*(yp-y1) - (y2-y1)*(xp-x1)
s2 = (x3-x2)*(yp-y2) - (y3-y2)*(xp-x2)
s3 = (x1-x3)*(yp-y3) - (y1-y3)*(xp-x3)
if numpy.sign(s1) == numpy.sign(s2) and numpy.sign(s1) == numpy.sign(s3):
print("YES")
else:
print("NO")
except:
break
|
s428566192 | p00012 | u764789069 | 1515222470 | Python | Python | py | Runtime Error | 0 | 0 | 628 | import numpy
while True:
try:
x1,y1,x2,y2,x3,y3,xp,yp=map(float,raw_input().split())
AB=numpy.array([x2-x1,y2-y1])
AP=numpy.array([xp-x1,yp-y1])
BC=numpy.array([x3-x2,y3-y2])
BP=numpy.array([xp-x2,yp-y2])
CA=numpy.array([x1-x3,y1-y3])
CP=numpy.array([xp-x3,yp-y3])
#print numpy.cross(AB,AP)
if (numpy.cross(AB,AP) < 0 and numpy.cross(BC,BP) < 0 and numpy.cross(CA,CP) < 0) or\
(numpy.cross(AB,AP) > 0 and numpy.cross(BC,BP) > 0 and numpy.cross(CA,CP) > 0):
print "YES"
else:
print "NO"
except:
break
|
s478156995 | p00012 | u764789069 | 1515222876 | Python | Python | py | Runtime Error | 0 | 0 | 628 | import numpy
while True:
try:
x1,y1,x2,y2,x3,y3,xp,yp=map(float,raw_input().split())
AB=numpy.array([x2-x1,y2-y1])
AP=numpy.array([xp-x1,yp-y1])
BC=numpy.array([x3-x2,y3-y2])
BP=numpy.array([xp-x2,yp-y2])
CA=numpy.array([x1-x3,y1-y3])
CP=numpy.array([xp-x3,yp-y3])
#print numpy.cross(AB,AP)
if (numpy.cross(AB,AP) < 0 and numpy.cross(BC,BP) < 0 and numpy.cross(CA,CP) < 0) or\
(numpy.cross(AB,AP) > 0 and numpy.cross(BC,BP) > 0 and numpy.cross(CA,CP) > 0):
print 'YES'
else:
print 'NO'
except:
break
|
s073071617 | p00012 | u150984829 | 1516787593 | Python | Python3 | py | Runtime Error | 0 | 0 | 189 | import sys
for e in sys.stdin:
p,q,r,s,t,u,x,y=map(float,e.split())
a=((x-p)*(u-q)-(y-q)*(t-p))/((r-p)*(u-q)-(s-q)*(t-p))
b=(x-p-a*(r-p))/(t-p)
print(['No','Yes'][0<a<1-b and 0<b<1-a])
|
s901967145 | p00012 | u150984829 | 1516787728 | Python | Python3 | py | Runtime Error | 0 | 0 | 189 | import sys
for e in sys.stdin:
p,q,r,s,t,u,x,y=map(float,e.split())
a=((x-p)*(u-q)-(y-q)*(t-p))/((r-p)*(u-q)-(s-q)*(t-p))
b=(x-p-a*(r-p))/(t-p)
print(['NO','YES'][0<a<1-b and 0<b<1-a])
|
s540392412 | p00012 | u069727578 | 1520048687 | Python | Python3 | py | Runtime Error | 0 | 0 | 326 | while 1:
x1,y1,x2,y2,x3,y3,xp,yp=[float(p) for p in input().split()]
d_max=max((x2-x1)**2+(y2-y1)**2,(x3-x2)**2+(y3-y2)**2,(x3-x1)**2+(y3-y1)**2)
d1,d2,d3=(x2-x1)**2+(y2-y1)**2,(x3-x2)**2+(y3-y2)**2,(x3-x1)**2+(y3-y1)**2;
if max(d_max,d1,d2,d3) > d_max:
print("No")
else:
print("Yes")
|
s649009155 | p00012 | u069727578 | 1520728591 | Python | Python3 | py | Runtime Error | 0 | 0 | 689 |
x1,y1,x2,y2,x3,y3,xp,yp=[float(p) for p in input().split()]
x_vector_1to2=x2-x1;
y_vector_1to2=y2-y1;
x_vector_1to3=x3-x1;
y_vector_1to3=y3-y1;
x_vector_p=xp-x1;
y_vector_p=yp-y1;
def renritu(p,q,r,s,t,u): # renritu(p,q,r,s,t,u) px + qy = r sx+ty=u
a=p; b=q; c=r; d=s; e=t; f=u;
a1=a*d; b1=b*d; c1=c*d; d1=d*a; e1=e*a; f1=f*a;
res_y=b1-e1;
if res_y != 0 :
res_y =(c1-f1)/res_y;
res_x =(c-b*res_y)/a;
return(res_x,res_y)
else:
return(-1,-1)
res=renritu(x_vector_1to2,x_vector_1to3,x_vector_p,y_vector_1to2,y_vector_1to3,y_vector_p)
if res[0]=>0 and res[1]=>0 and res[0]+res[1]<1:
print("YES")
else:
print("NO")
|
s503808220 | p00012 | u069727578 | 1520820568 | Python | Python3 | py | Runtime Error | 0 | 0 | 780 | while(true):
x1,y1,x2,y2,x3,y3,xp,yp=[float(p) for p in input().split()]
x_vector_1to2=x2-x1;
y_vector_1to2=y2-y1;
x_vector_1to3=x3-x1;
y_vector_1to3=y3-y1;
x_vector_p=xp-x1;
y_vector_p=yp-y1;
def renritu(p,q,r,s,t,u): # renritu(p,q,r,s,t,u) px + qy = r sx+ty=u
a=p; b=q; c=r; d=s; e=t; f=u;
a1=a*d; b1=b*d; c1=c*d; d1=d*a; e1=e*a; f1=f*a;
res_y=b1-e1;
if res_y != 0 :
res_y =(c1-f1)/res_y;
res_x =(c-b*res_y)/a;
return(res_x,res_y)
else:
return(-1,-1)
res=renritu(x_vector_1to2,x_vector_1to3,x_vector_p,y_vector_1to2,y_vector_1to3,y_vector_p)
if res[0] >0 and res[1] >0 and (res[0]+res[1])<1:
print("YES")
else:
print("NO")
|
s920274659 | p00012 | u069727578 | 1520820606 | Python | Python3 | py | Runtime Error | 0 | 0 | 780 | while(True):
x1,y1,x2,y2,x3,y3,xp,yp=[float(p) for p in input().split()]
x_vector_1to2=x2-x1;
y_vector_1to2=y2-y1;
x_vector_1to3=x3-x1;
y_vector_1to3=y3-y1;
x_vector_p=xp-x1;
y_vector_p=yp-y1;
def renritu(p,q,r,s,t,u): # renritu(p,q,r,s,t,u) px + qy = r sx+ty=u
a=p; b=q; c=r; d=s; e=t; f=u;
a1=a*d; b1=b*d; c1=c*d; d1=d*a; e1=e*a; f1=f*a;
res_y=b1-e1;
if res_y != 0 :
res_y =(c1-f1)/res_y;
res_x =(c-b*res_y)/a;
return(res_x,res_y)
else:
return(-1,-1)
res=renritu(x_vector_1to2,x_vector_1to3,x_vector_p,y_vector_1to2,y_vector_1to3,y_vector_p)
if res[0] >0 and res[1] >0 and (res[0]+res[1])<1:
print("YES")
else:
print("NO")
|
s581318147 | p00012 | u069727578 | 1520820662 | Python | Python3 | py | Runtime Error | 0 | 0 | 780 | while(True):
x1,y1,x2,y2,x3,y3,xp,yp=[float(p) for p in input().split()]
x_vector_1to2=x2-x1;
y_vector_1to2=y2-y1;
x_vector_1to3=x3-x1;
y_vector_1to3=y3-y1;
x_vector_p=xp-x1;
y_vector_p=yp-y1;
def renritu(p,q,r,s,t,u): # renritu(p,q,r,s,t,u) px + qy = r sx+ty=u
a=p; b=q; c=r; d=s; e=t; f=u;
a1=a*d; b1=b*d; c1=c*d; d1=d*a; e1=e*a; f1=f*a;
res_y=b1-e1;
if res_y != 0 :
res_y =(c1-f1)/res_y;
res_x =(c-b*res_y)/a;
return(res_x,res_y)
else:
return(-1,-1)
res=renritu(x_vector_1to2,x_vector_1to3,x_vector_p,y_vector_1to2,y_vector_1to3,y_vector_p)
if res[0] >0 and res[1] >0 and (res[0]+res[1])<1:
print("YES")
else:
print("NO")
|
s072074434 | p00012 | u069727578 | 1520820843 | Python | Python3 | py | Runtime Error | 0 | 0 | 783 | while(True):
x1,y1,x2,y2,x3,y3,xp,yp=[float(p) for p in input().split()]
x_vector_1to2=x2-x1;
y_vector_1to2=y2-y1;
x_vector_1to3=x3-x1;
y_vector_1to3=y3-y1;
x_vector_p=xp-x1;
y_vector_p=yp-y1;
def renritu(p,q,r,s,t,u): # renritu(p,q,r,s,t,u) px + qy = r sx+ty=u
a=p; b=q; c=r; d=s; e=t; f=u;
a1=a*d; b1=b*d; c1=c*d; d1=d*a; e1=e*a; f1=f*a;
res_y=b1-e1;
if res_y != 0 :
res_y =(c1-f1)/res_y;
res_x =(c-b*res_y)/a;
return(res_x,res_y)
else:
return(-1,-1)
res=renritu(x_vector_1to2,x_vector_1to3,x_vector_p,y_vector_1to2,y_vector_1to3,y_vector_p)
if res[0] >=0 and res[1] >=0 and (res[0]+res[1])<=1:
print("YES")
else:
print("NO")
|
s761608732 | p00012 | u069727578 | 1520820956 | Python | Python3 | py | Runtime Error | 0 | 0 | 783 | while(True):
x1,y1,x2,y2,x3,y3,xp,yp=[float(p) for p in input().split()]
x_vector_1to2=x2-x1;
y_vector_1to2=y2-y1;
x_vector_1to3=x3-x1;
y_vector_1to3=y3-y1;
x_vector_p=xp-x1;
y_vector_p=yp-y1;
def renritu(p,q,r,s,t,u): # renritu(p,q,r,s,t,u) px + qy = r sx+ty=u
a=p; b=q; c=r; d=s; e=t; f=u;
a1=a*d; b1=b*d; c1=c*d; d1=d*a; e1=e*a; f1=f*a;
res_y=b1-e1;
if res_y != 0 :
res_y =(c1-f1)/res_y;
res_x =(c-b*res_y)/a;
return(res_x,res_y)
else:
return(-1,-1)
res=renritu(x_vector_1to2,x_vector_1to3,x_vector_p,y_vector_1to2,y_vector_1to3,y_vector_p)
if res[0] >=0 and res[1] >=0 and (res[0]+res[1])<=1:
print('YES')
else:
print('NO')
|
s484249181 | p00012 | u166871988 | 1523707198 | Python | Python3 | py | Runtime Error | 0 | 0 | 451 | import math
lm=lambda x,y,xa,ya,xb,yb:abs((yb-ya)/(xb-xa)*xa+xa - y + (yb-ya)/(xb-xa)*x) / math.hypot((yb-ya)/(xb-xa),-1) if (xb-xa)!=0 else abs(x-xb)
while True:
r=input()
if r=="":break
x1,y1,x2,y2,x3,y3,xp,yp=[float(i) for i in r.split()]
if lm(x1,y1,x2,y2,x3,y3)<lm(xp,yp,x2,y2,x3,y3) or lm(x2,y2,x1,y1,x3,y3)<lm(xp,yp,x1,y1,x3,y3) or lm(x3,y3,x1,y1,x2,y2)<lm(xp,yp,x1,y1,x2,y2):
print("NO")
else:
print("YES")
|
s938699628 | p00012 | u166871988 | 1523707250 | Python | Python3 | py | Runtime Error | 0 | 0 | 451 | import math
lm=lambda x,y,xa,ya,xb,yb:abs((yb-ya)/(xb-xa)*xa+xa - y + (yb-ya)/(xb-xa)*x) / math.hypot((yb-ya)/(xb-xa),-1) if (xb-xa)!=0 else abs(x-xb)
while True:
r=input()
if r=="":break
x1,y1,x2,y2,x3,y3,xp,yp=[float(i) for i in r.split()]
if lm(x1,y1,x2,y2,x3,y3)<lm(xp,yp,x2,y2,x3,y3) or lm(x2,y2,x1,y1,x3,y3)<lm(xp,yp,x1,y1,x3,y3) or lm(x3,y3,x1,y1,x2,y2)<lm(xp,yp,x1,y1,x2,y2):
print("NO")
else:
print("YES")
|
s051582293 | p00012 | u166871988 | 1523707829 | Python | Python3 | py | Runtime Error | 0 | 0 | 489 | import math
def lm(x,y,xa,ya,xb,yb):
if (xb-xa)==0:return abs(x-xb)
d=(yb-ya)/(xb-xa)
return abs(d*xa+xa - y + d*x) / math.hypot(d,-1)
while True:
r=input()
if r=="":break
x1,y1,x2,y2,x3,y3,xp,yp=[float(i) for i in r.split()]
a=bool(lm(x1,y1,x2,y2,x3,y3)<lm(xp,yp,x2,y2,x3,y3))
b=bool(lm(x2,y2,x1,y1,x3,y3)<lm(xp,yp,x1,y1,x3,y3))
c=bool(lm(x3,y3,x1,y1,x2,y2)<lm(xp,yp,x1,y1,x2,y2))
if a or b or c:
print("NO")
else:
print("YES")
|
s969556574 | p00012 | u166871988 | 1523709772 | Python | Python3 | py | Runtime Error | 0 | 0 | 477 | g=lambda a,b:abs(a[0]*b[1]-a[1]*b[0])
while True:
l=[float(i) for i in input().split()]
if not l:break
ba=[l[0]-l[2],l[1]-l[3]]
ab=[-i for i in ba]
cb=[l[2]-l[4],l[3]-l[5]]
bc=[-i for i in cb]
ca=[l[0]-l[4],l[1]-l[5]]
ac=[-i for i in ca]
ap=[l[6]-l[0],l[7]-l[1]]
bp=[l[6]-l[2],l[7]-l[3]]
cp=[l[6]-l[4],l[7]-l[5]]
if g(ab,ac)<g(ab,ap) or g(ba,bc)<g(ba,bp) or g(ca,cb)<g(ca,cp):
print("NO")
else:
print("YES")
|
s834071131 | p00012 | u166871988 | 1523709804 | Python | Python3 | py | Runtime Error | 0 | 0 | 485 | g=lambda a,b:abs(a[0]*b[1]-a[1]*b[0])
while True:
t=input()
if t=="":break
l=[float(i) for i in t.split()]
ba=[l[0]-l[2],l[1]-l[3]]
ab=[-i for i in ba]
cb=[l[2]-l[4],l[3]-l[5]]
bc=[-i for i in cb]
ca=[l[0]-l[4],l[1]-l[5]]
ac=[-i for i in ca]
ap=[l[6]-l[0],l[7]-l[1]]
bp=[l[6]-l[2],l[7]-l[3]]
cp=[l[6]-l[4],l[7]-l[5]]
if g(ab,ac)<g(ab,ap) or g(ba,bc)<g(ba,bp) or g(ca,cb)<g(ca,cp):
print("NO")
else:
print("YES")
|
s600517701 | p00012 | u166871988 | 1523709868 | Python | Python3 | py | Runtime Error | 0 | 0 | 464 | g=lambda a,b:abs(a[0]*b[1]-a[1]*b[0])
while True:
t=input()
if t=="":break
l=[float(i) for i in t.split()]
ba=[l[0]-l[2],l[1]-l[3]]
ab=[-i for i in ba]
cb=[l[2]-l[4],l[3]-l[5]]
bc=[-i for i in cb]
ca=[l[0]-l[4],l[1]-l[5]]
ac=[-i for i in ca]
ap=[l[6]-l[0],l[7]-l[1]]
bp=[l[6]-l[2],l[7]-l[3]]
cp=[l[6]-l[4],l[7]-l[5]]
if g(ab,ac)<g(ab,ap) or g(ba,bc)<g(ba,bp):
print("NO")
else:
print("YES")
|
s736066125 | p00012 | u166871988 | 1523709875 | Python | Python3 | py | Runtime Error | 0 | 0 | 427 | g=lambda a,b:abs(a[0]*b[1]-a[1]*b[0])
while True:
t=input()
if t=="":break
l=[float(i) for i in t.split()]
ba=[l[0]-l[2],l[1]-l[3]]
ab=[-i for i in ba]
cb=[l[2]-l[4],l[3]-l[5]]
bc=[-i for i in cb]
ca=[l[0]-l[4],l[1]-l[5]]
ac=[-i for i in ca]
ap=[l[6]-l[0],l[7]-l[1]]
bp=[l[6]-l[2],l[7]-l[3]]
cp=[l[6]-l[4],l[7]-l[5]]
if 0:
print("NO")
else:
print("YES")
|
s744238328 | p00012 | u166871988 | 1523709936 | Python | Python3 | py | Runtime Error | 0 | 0 | 494 | g=lambda a,b:abs(a[0]*b[1]-a[1]*b[0])
while True:
t=input()
if t=="":
break
l=[float(i) for i in t.split()]
ba=[l[0]-l[2],l[1]-l[3]]
ab=[-i for i in ba]
cb=[l[2]-l[4],l[3]-l[5]]
bc=[-i for i in cb]
ca=[l[0]-l[4],l[1]-l[5]]
ac=[-i for i in ca]
ap=[l[6]-l[0],l[7]-l[1]]
bp=[l[6]-l[2],l[7]-l[3]]
cp=[l[6]-l[4],l[7]-l[5]]
if g(ab,ac)<g(ab,ap) or g(ba,bc)<g(ba,bp) or g(ca,cb)<g(ca,cp):
print("NO")
else:
print("YES")
|
s578061499 | p00012 | u719737030 | 1351003214 | Python | Python | py | Runtime Error | 0 | 5012 | 409 | import sys
def cross(a,b,p):
return ((b[0]-a[0])*(p[1]-a[1])) - ((p[0]-a[0])*(b[1]-a[1]))
for i in sys.stdin.readlines():
l = [float(x) for x in i.split()]
a,b,c,p = [l[:2],l[2:4],l[4:6],l[6:]]
if cross(a,b,p)<=0 and cross(b,c,p)<=0 and cross(c,a,p)<=0 :
print "YES"
elif cross(a,b,p)>=0 and cross(b,c,p)>=0 and cross(c,a,p)>=0 :
print "YES"
else:
print "N0" |
s670284173 | p00012 | u719737030 | 1351003459 | Python | Python | py | Runtime Error | 0 | 5012 | 397 | import sys
def cross(a,b,p):
return ((b[0]-a[0])*(p[1]-a[1])) - ((p[0]-a[0])*(b[1]-a[1]))
for i in sys.stdin:
l = [float(x) for x in i.split()]
a,b,c,p = [l[:2],l[2:4],l[4:6],l[6:]]
if cross(a,b,p)<=0 and cross(b,c,p)<=0 and cross(c,a,p)<=0 :
print "YES"
elif cross(a,b,p)>=0 and cross(b,c,p)>=0 and cross(c,a,p)>=0 :
print "YES"
else:
print "N0" |
s772048376 | p00012 | u759949288 | 1351585335 | Python | Python | py | Runtime Error | 0 | 11000 | 667 | import sys
def cross(a, b):
return (a.conjugate() * b).real
def dot(a, b):
return (a.conjugate() * b).imag
def ccw(a, b, c):
x = b - a
y = c - a;
if cross(x, y) > 0: return 1
if cross(x, y) < 0: return -1
if dot(x, y) < 0: return 2
if abs(x) < abs(y): return -2
return 0
def solve(l, p):
x = ccw(l[0][0], l[0][1], p)
x = int(x / abs(x))
for i in l[1:]:
y = ccw(i[0], i[1], p)
y = int(y / abs(y))
if x != y:
print "NO"
return
print 'YES'
for line in sys.stdin:
ax, ay, bx, by, cx, cy, px, py = map(float, line.split())
a = complex(ax, ay)
b = complex(bx, by)
c = complex(cx, cy)
p = complex(px, py)
solve([(a, b), (b, c), (c, a)], p) |
s953870444 | p00012 | u759949288 | 1351585364 | Python | Python | py | Runtime Error | 0 | 11000 | 667 | import sys
def cross(a, b):
return (a.conjugate() * b).real
def dot(a, b):
return (a.conjugate() * b).imag
def ccw(a, b, c):
x = b - a
y = c - a;
if cross(x, y) > 0: return 1
if cross(x, y) < 0: return -1
if dot(x, y) < 0: return 2
if abs(x) < abs(y): return -2
return 0
def solve(l, p):
x = ccw(l[0][0], l[0][1], p)
x = int(x / abs(x))
for i in l[1:]:
y = ccw(i[0], i[1], p)
y = int(y / abs(y))
if x != y:
print "NO"
return
print 'YES'
for line in sys.stdin:
ax, ay, bx, by, cx, cy, px, py = map(float, line.split())
a = complex(ax, ay)
b = complex(bx, by)
c = complex(cx, cy)
p = complex(px, py)
solve([(a, b), (b, c), (c, a)], p) |
s114968465 | p00012 | u759949288 | 1351585457 | Python | Python | py | Runtime Error | 0 | 11000 | 694 | import sys
def cross(a, b):
return (a.conjugate() * b).real
def dot(a, b):
return (a.conjugate() * b).imag
def ccw(a, b, c):
x = b - a
y = c - a;
if cross(x, y) > 0: return 1
if cross(x, y) < 0: return -1
if dot(x, y) < 0: return 2
if abs(x) < abs(y): return -2
return 0
def solve(l, p):
x = ccw(l[0][0], l[0][1], p)
if x != 0:
x = int(x / abs(x))
for i in l[1:]:
y = ccw(i[0], i[1], p)
if y != 0:
y = int(y / abs(y))
if x != y:
print "NO"
return
print 'YES'
for line in sys.stdin:
ax, ay, bx, by, cx, cy, px, py = map(float, line.split())
a = complex(ax, ay)
b = complex(bx, by)
c = complex(cx, cy)
p = complex(px, py)
solve([(a, b), (b, c), (c, a)], p) |
s012715801 | p00012 | u647766105 | 1351608885 | Python | Python | py | Runtime Error | 0 | 0 | 490 | import sys
for line in sys.stdin:
list=map(float,line.split())
x=list[0:6:2]
y=list[1:6:2]
xp=list[6]
yp=list[7]
xv=[x[a%3]-x[(a+1)%3] for a in xrange(4)]
yv=[y[a%3]-y[(a+1)%3] for a in xrange(4)]
xpv=[xp-x[a] for a in xrange(3)]
ypv=[yp-y[a] for a in xrange(3)]
cross=[xv[i]*ypv[i]-yv[i]*xpv[i] for i in xrange(3)]
sorted(cross)
if (cross[2]>0 and cross[0]>0) or (cross[2]<0 and cross[0]<0):
print "YES"
else:
print "NO" |
s079557232 | p00012 | u647766105 | 1351609131 | Python | Python | py | Runtime Error | 0 | 0 | 502 | import sys
for line in sys.stdin.readlines():
list=map(float,line.split())
x=list[0:6:2]
y=list[1:6:2]
xp=list[6]
yp=list[7]
xv=[x[a%3]-x[(a+1)%3] for a in xrange(4)]
yv=[y[a%3]-y[(a+1)%3] for a in xrange(4)]
xpv=[xp-x[a] for a in xrange(3)]
ypv=[yp-y[a] for a in xrange(3)]
cross=[xv[i]*ypv[i]-yv[i]*xpv[i] for i in xrange(3)]
sorted(cross)
if (cross[2]>0 and cross[0]>0) or (cross[2]<0 and cross[0]<0):
print "YES"
else:
print "NO" |
s055599028 | p00012 | u647766105 | 1351609262 | Python | Python | py | Runtime Error | 0 | 0 | 505 | import sys
for line in sys.stdin.readlines():
list=map(float,line.split(" "))
x=list[0:6:2]
y=list[1:6:2]
xp=list[6]
yp=list[7]
xv=[x[a%3]-x[(a+1)%3] for a in xrange(4)]
yv=[y[a%3]-y[(a+1)%3] for a in xrange(4)]
xpv=[xp-x[a] for a in xrange(3)]
ypv=[yp-y[a] for a in xrange(3)]
cross=[xv[i]*ypv[i]-yv[i]*xpv[i] for i in xrange(3)]
sorted(cross)
if (cross[2]>0 and cross[0]>0) or (cross[2]<0 and cross[0]<0):
print "YES"
else:
print "NO" |
s035982193 | p00012 | u719737030 | 1351670113 | Python | Python | py | Runtime Error | 0 | 4948 | 397 | import sys
def cross(a,b,p):
return ((b[0]-a[0])*(p[1]-a[1])) - ((p[0]-a[0])*(b[1]-a[1]))
for i in sys.stdin:
l = [float(x) for x in i.split()]
a,b,c,p = [l[:2],l[2:4],l[4:6],l[6:]]
if cross(a,b,p)<=0 and cross(b,c,p)<=0 and cross(c,a,p)<=0 :
print "YES"
elif cross(a,b,p)>=0 and cross(b,c,p)>=0 and cross(c,a,p)>=0 :
print "YES"
else:
print "N0" |
s869722286 | p00012 | u779627195 | 1352480176 | Python | Python | py | Runtime Error | 0 | 1612 | 1091 | #coding: utf-8
def isInOut(p, q, s, c, z):
if (p*c[0] + q*c[1] - s)*(p*z[0] + q*z[1] - s) > 0:
return True
else:
return False
while 1:
try:
x = [0 for i in xrange(3)]
y = [0 for i in xrange(3)]
c = [0 for i in xrange(2)]
z = [0 for i in xrange(2)]
a,b,t = [[0 for i in xrange(2)] for i in xrange(3)]
p,q,s = [[0 for i in xrange(3)] for i in xrange(3)]
x[0],y[0],x[1],y[1],x[2],y[2],z[0],z[1] = map(float, raw_input().split())
c = [sum(x)/3, sum(y)/3]
for j in xrange(3):
if x[j] == x[j-1]:
p[j] = 1.
q[j] = 0.
s[j] = x[j]
else:
t[j] = (y[j] - y[j-1]) / (x[j] - x[j-1])
p[j] = t[j]
q[j] = -1.
s[j] = t[j]*x[j]-y[j]
#print p[j], q[j], s[j]
if isInOut(p[j], q[j], s[j], c, z) is False:
print "NO"
break
else:
print "YES"
except EOFError:
break |
s690031725 | p00012 | u779627195 | 1352480386 | Python | Python | py | Runtime Error | 0 | 1612 | 1066 | #coding: utf-8
def isInOut(p, q, s, c, z):
if (p*c[0] + q*c[1] - s)*(p*z[0] + q*z[1] - s) > 0:
return True
else:
return False
while 1:
try:
x = [0 for i in xrange(3)]
y = [0 for i in xrange(3)]
c = [0 for i in xrange(2)]
z = [0 for i in xrange(2)]
t = [0 for i in xrange(3)]
p,q,s = [[0 for i in xrange(3)] for i in xrange(3)]
x[0],y[0],x[1],y[1],x[2],y[2],z[0],z[1] = map(float, raw_input().split())
c = [sum(x)/3, sum(y)/3]
for j in xrange(3):
if x[j] == x[j-1]:
p[j] = 1.
q[j] = 0.
s[j] = x[j]
else:
t[j] = (y[j] - y[j-1]) / (x[j] - x[j-1])
p[j] = t[j]
q[j] = -1.
s[j] = t[j]*x[j]-y[j]
#print p[j], q[j], s[j]
if isInOut(p[j], q[j], s[j], c, z) is False:
print "NO"
break
else:
print "YES"
except EOFError:
break |
s819824163 | p00012 | u779627195 | 1352538562 | Python | Python | py | Runtime Error | 0 | 5372 | 916 | #coding: utf-8
def dot(a, b):
return (a.real*b.real - a.imag*b.imag)
def cross(a, b):
return (a.real*b.imag - a.imag*b.real)
EPS = 10**(-7)
def isIntersectedLS(a1, a2, b1, b2):
return ((cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1)) < EPS and
(cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1)) < EPS)
while 1:
try:
x,y = [[0 for i in xrange(3)] for j in xrange(2)]
a = []
z = [0 for i in xrange(2)]
x[0],y[0],x[1],y[1],x[2],y[2],z[0],z[1] = map(float, raw_input().split())
for i in xrange(3):
a.append((x[i]+(y[i])*1j))
c = (sum(x)/3)+(sum(y)/3)*1j
p = z[0]+z[1]*1j
for i in xrange(3):
#print a, c, p
if isIntersectedLS(a[i-1], a[i], c, p) is True:
print "NO"
break
else:
print "YES"
except EOFError:
break |
s404757191 | p00012 | u779627195 | 1352538613 | Python | Python | py | Runtime Error | 0 | 5372 | 901 | def dot(a, b):
return (a.real*b.real - a.imag*b.imag)
def cross(a, b):
return (a.real*b.imag - a.imag*b.real)
EPS = 10**(-7)
def isIntersectedLS(a1, a2, b1, b2):
return ((cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1)) < EPS and
(cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1)) < EPS)
while 1:
try:
x,y = [[0 for i in xrange(3)] for j in xrange(2)]
a = []
z = [0 for i in xrange(2)]
x[0],y[0],x[1],y[1],x[2],y[2],z[0],z[1] = map(float, raw_input().split())
for i in xrange(3):
a.append((x[i]+(y[i])*1j))
c = (sum(x)/3)+(sum(y)/3)*1j
p = z[0]+z[1]*1j
for i in xrange(3):
#print a, c, p
if isIntersectedLS(a[i-1], a[i], c, p) is True:
print "NO"
break
else:
print "YES"
except EOFError:
break |
s630839477 | p00012 | u779627195 | 1352539350 | Python | Python | py | Runtime Error | 0 | 5372 | 898 | def dot(a, b):
return (a.real*b.real - a.imag*b.imag)
def cross(a, b):
return (a.real*b.imag - a.imag*b.real)
EPS = 10**(-7)
def isIntersectedLS(a1, a2, b1, b2):
return ((cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1)) < EPS and
(cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1)) < EPS)
while 1:
try:
x,y = [[0 for i in range(3)] for j in range(2)]
a = []
z = [0 for i in range(2)]
x[0],y[0],x[1],y[1],x[2],y[2],z[0],z[1] = map(float, raw_input().split())
for i in xrange(3):
a.append((x[i]+(y[i])*1j))
c = (sum(x)/3)+(sum(y)/3)*1j
p = z[0]+z[1]*1j
for i in xrange(3):
#print a, c, p
if isIntersectedLS(a[i-1], a[i], c, p) is True:
print "NO"
break
else:
print "YES"
except EOFError:
break |
s277764634 | p00012 | u779627195 | 1352541143 | Python | Python | py | Runtime Error | 0 | 5372 | 1038 | def dot(a, b):
return (a.real*b.real - a.imag*b.imag)
def cross(a, b):
return (a.real*b.imag - a.imag*b.real)
EPS = 10**(-7)
def isIntersectedLS(a1, a2, b1, b2):
return ((cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1)) < EPS and
(cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1)) < EPS)
def main():
while 1:
try:
x,y = [[0. for i in xrange(3)] for j in xrange(2)]
a = []
z = [0. for i in xrange(2)]
x[0],y[0],x[1],y[1],x[2],y[2],z[0],z[1] = map(float, raw_input().split())
for i in xrange(3):
a.append((x[i]+(y[i])*1j))
c = (sum(x)/3)+(sum(y)/3)*1j
p = z[0]+z[1]*1j
for i in xrange(3):
#print a, c, p
if isIntersectedLS(a[i-1], a[i], c, p) is True:
print "NO"
break
else:
print "YES"
except EOFError:
break
if __name__ == '__main__':
main() |
s905289987 | p00012 | u779627195 | 1352542048 | Python | Python | py | Runtime Error | 0 | 5372 | 878 | def dot(a, b):
return (a.real*b.real - a.imag*b.imag)
def cross(a, b):
return (a.real*b.imag - a.imag*b.real)
EPS = 10**(-7)
def isIntersectedLS(a1, a2, b1, b2):
return ((cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1)) < EPS and
(cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1)) < EPS)
while 1:
try:
x1,y1,x2,y2,x3,y3 = (0,0,0,0,0,0)
a = []
xp,yp = (0,0)
x1,y1,x2,y2,x3,y3,xp,yp = map(float, raw_input().split())
a.append(x1+(y1)*1j)
a.append(x2+(y2)*1j)
a.append(x3+(y3)*1j)
c = (x1+x2+x3)/3+((y1+y2+y3)/3)*1j
p = xp+yp*1j
for i in xrange(3):
#print a, c, p
if isIntersectedLS(a[i-1], a[i], c, p) is True:
print "NO"
break
else:
print "YES"
except EOFError:
break |
s198977166 | p00012 | u779627195 | 1352549671 | Python | Python | py | Runtime Error | 0 | 5440 | 936 | def dot(a, b):
return (a.real*b.real - a.imag*b.imag)
def cross(a, b):
return (a.real*b.imag - a.imag*b.real)
EPS = 10**(-7)
def isIntersectedLS(a1, a2, b1, b2):
return ((cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1)) < EPS and
(cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1)) < EPS)
while 1:
try:
x,y = [[0. for i in xrange(3)] for j in xrange(2)]
a = []
xp,yp = (0,0)
line = raw_input().split()
if line == []: break
x[0],y[0],x[1],y[1],x[2],y[2],z[0],z[1] = map(float, line)
for i in xrange(3):
a.append((x[i]+(y[i])*1j))
c = (sum(x)/3)+(sum(y)/3)*1j
p = z[0]+z[1]*1j
for i in xrange(3):
#print a, c, p
if isIntersectedLS(a[i-1], a[i], c, p) is True:
print "NO"
break
else:
print "YES"
except EOFError:
break |
s015594002 | p00012 | u779627195 | 1352549740 | Python | Python | py | Runtime Error | 0 | 5440 | 932 | def dot(a, b):
return (a.real*b.real - a.imag*b.imag)
def cross(a, b):
return (a.real*b.imag - a.imag*b.real)
EPS = 10**(-7)
def isIntersectedLS(a1, a2, b1, b2):
return ((cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1)) < EPS and
(cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1)) < EPS)
while 1:
try:
x,y = [[0. for i in xrange(3)] for j in xrange(2)]
a = []
z = (0,0)
line = raw_input().split()
if line == []: break
x[0],y[0],x[1],y[1],x[2],y[2],z[0],z[1] = map(float, line)
for i in xrange(3):
a.append((x[i]+(y[i])*1j))
c = (sum(x)/3)+(sum(y)/3)*1j
p = z[0]+z[1]*1j
for i in xrange(3):
#print a, c, p
if isIntersectedLS(a[i-1], a[i], c, p) is True:
print "NO"
break
else:
print "YES"
except EOFError:
break |
s647870759 | p00012 | u504990413 | 1353088421 | Python | Python | py | Runtime Error | 0 | 1012 | 788 | def heron(a,b,c):
s = 0.5*(a+b+c)
return (s*(s-a)*(s-b)*(s-c))**0.5
while True:
try:
x = map(float, raw_input().split(' '))
ab = ((x[0]-x[2])**2 +(x[1]-x[3])**2)**0.5
bc = ((x[2]-x[4])**2 +(x[3]-x[5])**2)**0.5
ca = ((x[4]-x[0])**2 +(x[5]-x[1])**2)**0.5
area_abc = heron(ab,bc,ca)
oa = ((x[0]-x[6])**2 +(x[1]-x[7])**2)**0.5
ob = ((x[2]-x[6])**2 +(x[3]-x[7])**2)**0.5
oc = ((x[4]-x[6])**2 +(x[5]-x[7])**2)**0.5
area_oab = heron(ab,oa,ob)
area_obc = heron(bc,ob,oc)
area_oca = heron(ca,oc,oa)
area_sum = area_oab+area_obc+area_oca
if round(area_abc,2) < round(area_sum,2):
print 'NO'
else:
print 'YES'
except EOFError:
break |
s761217174 | p00012 | u504990413 | 1353088720 | Python | Python | py | Runtime Error | 0 | 1012 | 784 | def heron(a,b,c):
s = 0.5*(a+b+c)
return (s*(s-a)*(s-b)*(s-c))**0.5
while True:
try:
x = map(float, raw_input().split(' '))
ab = ((x[0]-x[2])**2 +(x[1]-x[3])**2)**0.5
bc = ((x[2]-x[4])**2 +(x[3]-x[5])**2)**0.5
ca = ((x[4]-x[0])**2 +(x[5]-x[1])**2)**0.5
area_abc = heron(ab,bc,ca)
oa = ((x[0]-x[6])**2 +(x[1]-x[7])**2)**0.5
ob = ((x[2]-x[6])**2 +(x[3]-x[7])**2)**0.5
oc = ((x[4]-x[6])**2 +(x[5]-x[7])**2)**0.5
area_oab = heron(ab,oa,ob)
area_obc = heron(bc,ob,oc)
area_oca = heron(ca,oc,oa)
area_sum = area_oab+area_obc+area_oca
if round(area_abc) < round(area_sum):
print 'NO'
else:
print 'YES'
except EOFError:
break |
s645002114 | p00012 | u504990413 | 1353089975 | Python | Python | py | Runtime Error | 0 | 1012 | 788 | def heron(a,b,c):
s = 0.5*(a+b+c)
return (s*(s-a)*(s-b)*(s-c))**0.5
while True:
try:
x = map(float, raw_input().split(' '))
ab = ((x[0]-x[2])**2 +(x[1]-x[3])**2)**0.5
bc = ((x[2]-x[4])**2 +(x[3]-x[5])**2)**0.5
ca = ((x[4]-x[0])**2 +(x[5]-x[1])**2)**0.5
area_abc = heron(ab,bc,ca)
oa = ((x[0]-x[6])**2 +(x[1]-x[7])**2)**0.5
ob = ((x[2]-x[6])**2 +(x[3]-x[7])**2)**0.5
oc = ((x[4]-x[6])**2 +(x[5]-x[7])**2)**0.5
area_oab = heron(ab,oa,ob)
area_obc = heron(bc,ob,oc)
area_oca = heron(ca,oc,oa)
area_sum = area_oab+area_obc+area_oca
if round(area_abc,2) < round(area_sum,2):
print 'NO'
else:
print 'YES'
except EOFError:
break |
s099534444 | p00012 | u504990413 | 1353665363 | Python | Python | py | Runtime Error | 0 | 1264 | 378 |
while True:
try:
x1,y1,x2,y2,x3,y3,px,py = map(float,raw_input().split(' '))
v1 = [x1-px,y1-py]
v2 = [x2-px,y2-py]
v3 = [x3-px,y3-py]
v12 =[v1[0]+v2[0],v1[1]+v2[1]]
if v12[0]*v3[0]+v12[1]*v3[1] < 0:
print 'YES'
else:
print 'NO'
except EOFError:
break |
s968082055 | p00012 | u504990413 | 1353682591 | Python | Python | py | Runtime Error | 0 | 5048 | 379 | while True:
try:
x1,y1,x2,y2,x3,y3,px,py = map(float,raw_input().split(' '))
v1 = [x1-px,y1-py]
v2 = [x2-px,y2-py]
v3 = [x3-px,y3-py]
v12 =[v1[0]+v2[0],v1[1]+v2[1]]
if v12[0]*v3[0]+v12[1]*v3[1] < 0:
print 'YES'
else:
print 'NO'
except EOFError:
break |
s626502958 | p00012 | u504990413 | 1353716661 | Python | Python | py | Runtime Error | 0 | 1008 | 344 | while True:
try:
x1,y1,x2,y2,x3,y3,px,py = map(float,raw_input().split())
v1 = [x1-px,y1-py]
v2 = [x2-px,y2-py]
v3 = [x3-px,y3-py]
v12 =[v1[0]+v2[0],v1[1]+v2[1]]
if v12[0]*v3[0]+v12[1]*v3[1] < 0:
print 'YES'
else:
print 'NO'
except EOFError:
break |
s652883535 | p00012 | u126791750 | 1357120558 | Python | Python | py | Runtime Error | 0 | 0 | 406 | def checker(x1,y1,x2,y2,xp,yp):
vec = (x2 - x1) * (yp - y1) - (y2 - y1) * (xp - x1)
if vec > 0:
return 1
elif vec < 0:
return -1
while True:
try:
x1,y1,x2,y2,x3,y3,xp,yp = map(float,raw_input().split())
except EOFError:
break
r = checker(x1,y1,x2,y2,xp,yp)
r += checker(x2, y2, x3, y3, xp, yp)
r += checker(x3, y3, x1, y1, xp, yp)
if r == 3 or r == -3:
print("YES")
else:
print("NO") |
s952262433 | p00012 | u126791750 | 1357120618 | Python | Python | py | Runtime Error | 0 | 0 | 413 | def checker(x1,y1,x2,y2,xp,yp):
vec = (x2 - x1) * (yp - y1) - (y2 - y1) * (xp - x1)
if vec > 0:
return 1
elif vec < 0:
return -1
while True:
try:
x1,y1,x2,y2,x3,y3,xp,yp = map(float,raw_input().split())
r = checker(x1,y1,x2,y2,xp,yp)
r += checker(x2, y2, x3, y3, xp, yp)
r += checker(x3, y3, x1, y1, xp, yp)
if r == 3 or r == -3:
print("YES")
else:
print("NO")
except EOFError:
break |
s981092847 | p00012 | u126791750 | 1357120909 | Python | Python | py | Runtime Error | 0 | 0 | 413 | def checker(x1,y1,x2,y2,xp,yp):
vec = (x2 - x1) * (yp - y1) - (y2 - y1) * (xp - x1)
if vec > 0:
return 1
elif vec < 0:
return -1
while True:
try:
x1,y1,x2,y2,x3,y3,xp,yp = map(float,raw_input().split())
r = checker(x1,y1,x2,y2,xp,yp)
r += checker(x2, y2, x3, y3, xp, yp)
r += checker(x3, y3, x1, y1, xp, yp)
if r == 3 or r == -3:
print("YES")
else:
print("NO")
except EOFError:
break |
s089369479 | p00012 | u126791750 | 1357121059 | Python | Python | py | Runtime Error | 0 | 0 | 441 | global r
def checker(x1,y1,x2,y2,xp,yp):
vec = (x2 - x1) * (yp - y1) - (y2 - y1) * (xp - x1)
if vec > 0:
return 1
elif vec < 0:
return -1
while True:
try:
x1,y1,x2,y2,x3,y3,xp,yp = map(float,raw_input().split())
r = 0
r = r + checker(x1,y1,x2,y2,xp,yp)
r = r + checker(x2, y2, x3, y3, xp, yp)
r = r + checker(x3, y3, x1, y1, xp, yp)
if r == 3 or r == -3:
print("YES")
else:
print("NO")
except EOFError:
break |
s591932173 | p00012 | u126791750 | 1357121221 | Python | Python | py | Runtime Error | 0 | 0 | 472 | global r
def checker(x1,y1,x2,y2,xp,yp):
vec = (x2 - x1) * (yp - y1) - (y2 - y1) * (xp - x1)
if vec > 0:
return int(1)
elif vec < 0:
return int(-1)
while True:
try:
x1,y1,x2,y2,x3,y3,xp,yp = map(float,raw_input().split())
r = 0
r += checker(x1,y1,x2,y2,xp,yp)
print r
r += checker(x2, y2, x3, y3, xp, yp)
print r
r += checker(x3, y3, x1, y1, xp, yp)
print r
if r == 3 or r == -3:
print("YES")
else:
print("NO")
except EOFError:
break |
s015256381 | p00012 | u126791750 | 1357121355 | Python | Python | py | Runtime Error | 0 | 0 | 482 | global r
def checker(x1,y1,x2,y2,xp,yp):
vec = (x2 - x1) * (yp - y1) - (y2 - y1) * (xp - x1)
if vec > 0:
return int(1)
elif vec < 0:
return int(-1)
if __name__ == '__main__':
while True:
try:
x1,y1,x2,y2,x3,y3,xp,yp = map(float,raw_input().split())
r = 0
r += checker(x1,y1,x2,y2,xp,yp)
r += checker(x2, y2, x3, y3, xp, yp)
r += checker(x3, y3, x1, y1, xp, yp)
if r == 3 or r == -3:
print("YES")
else:
print("NO")
except EOFError:
break |
s319878761 | p00012 | u126791750 | 1357121586 | Python | Python | py | Runtime Error | 0 | 0 | 497 | global r
def checker(x1,y1,x2,y2,xp,yp):
vec = (x2 - x1) * (yp - y1) - (y2 - y1) * (xp - x1)
if vec > 0:
return int(1)
elif vec < 0:
return int(-1)
if __name__ == '__main__':
while True:
try:
x1,y1,x2,y2,x3,y3,xp,yp = map(float,raw_input().split())
r = 0
r += int(checker(x1,y1,x2,y2,xp,yp))
r += int(checker(x2, y2, x3, y3, xp, yp))
r += int(checker(x3, y3, x1, y1, xp, yp))
if r == 3 or r == -3:
print("YES")
else:
print("NO")
except EOFError:
break |
s336716975 | p00012 | u126791750 | 1357122350 | Python | Python | py | Runtime Error | 0 | 0 | 500 | def checker(x1,y1,x2,y2,xp,yp):
r = 0
vec = (x2 - x1) * (yp - y1) - (y2 - y1) * (xp - x1)
if vec > 0:
r = 1
return r
elif vec < 0:
r = -1
return r
if __name__ == '__main__':
while True:
try:
x1,y1,x2,y2,x3,y3,xp,yp = map(float,raw_input().split())
r = 0
r += int(checker(x1,y1,x2,y2,xp,yp))
r += int(checker(x2, y2, x3, y3, xp, yp))
r += int(checker(x3, y3, x1, y1, xp, yp))
if r == 3 or r == -3:
print("YES")
else:
print("NO")
except EOFError:
break |
s921932213 | p00012 | u633068244 | 1393358654 | Python | Python | py | Runtime Error | 0 | 0 | 945 | while True:
try:
x1,y1,x2,y2,x3,y3,xp,yp = map(float, raw_input().split())
a = (x1-x2)**2+(y1-y2)**2
b = (x1-x3)**2+(y1-y3)**2
c = (x2-x3)**2+(y2-y3)**2
xa = (x3-xp)**2+(y3-yp)**2
xb = (x2-xp)**2+(y2-yp)**2
xc = (x1-xp)**2+(y1-yp)**2
cosa = (a-b+c)/(2*math.sqrt(b)*math.sqrt(c))
cosb = (b-a+c)/(2*math.sqrt(a)*math.sqrt(c))
cosc = (c-a+b)/(2*math.sqrt(a)*math.sqrt(b))
cos1 = (xc-xa+xc)/(2*math.sqrt(xa)*math.sqrt(b))
cos2 = (xa-c+xb)/(2*math.sqrt(xb)*math.sqrt(c))
cos3 = (xb-a+xc)/(2*math.sqrt(xc)*math.sqrt(a))
# cos4 = (a-b+c)/(2*math.sqrt(xa)*math.sqrt(c))
# cos5 = (a-b+c)/(2*math.sqrt(xb)*math.sqrt(a))
# cos6 = (a-b+c)/(2*math.sqrt(xc)*math.sqrt(b))
if cos1<cosa or cos2<cosb or cos3<cosc:
print "YES"
print "YES"
else:
print "NO"
except:
break |
s972301940 | p00013 | u506132575 | 1416116969 | Python | Python | py | Runtime Error | 0 | 0 | 152 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
lis = []
while True:
d = input()
if d == 0:
print lis[-1]
lis.pop()
else:
lis.append(d) |
s738803340 | p00013 | u567380442 | 1422619995 | Python | Python3 | py | Runtime Error | 0 | 0 | 136 | import sys
cars = []
for line in sys.stdin:
car = int(line)
if car:
cars.append(num)
else:
print(cars.pop()) |
s294895272 | p00013 | u463990569 | 1452846960 | Python | Python3 | py | Runtime Error | 0 | 0 | 128 | garage = []
while True:
num = int(input())
if num == 0:
print(garage.pop())
else:
garage.append(num) |
s181752995 | p00013 | u580607517 | 1453044249 | Python | Python | py | Runtime Error | 0 | 0 | 105 | rail = []
while True:
n = int(raw_input())
if n != 0:
rail.append(n)
else:
print rail.pop() |
s027542509 | p00013 | u744114948 | 1465016296 | Python | Python3 | py | Runtime Error | 0 | 0 | 107 | a = []
while True:
s = int(input())
if s != 0:
a.append(s)
else:
print(a.pop()) |
s238079270 | p00013 | u393305246 | 1474277562 | Python | Python | py | Runtime Error | 0 | 0 | 155 | list=[]
list.append(input())
While list!=[]:
inp=input()
if inp==0:
print list[-1]
del list[-1]
else:
list.append(inp) |
s769178291 | p00013 | u393305246 | 1474277719 | Python | Python | py | Runtime Error | 0 | 0 | 146 | lis=[]
lis.append(input())
while True:
inp=input()
if inp==0:
print lis[-1]
del lis[-1]
else:
lis.append(inp) |
s279322457 | p00013 | u393305246 | 1474277737 | Python | Python | py | Runtime Error | 0 | 0 | 146 | lis=[]
lis.append(input())
while true:
inp=input()
if inp==0:
print lis[-1]
del lis[-1]
else:
lis.append(inp) |
s221406126 | p00013 | u393305246 | 1474277849 | Python | Python | py | Runtime Error | 0 | 0 | 146 | lis=[]
lis.append(input())
while True:
inp=input()
if inp==0:
print lis[-1]
del lis[-1]
else:
lis.append(inp) |
s116051221 | p00013 | u252368621 | 1479003231 | Python | Python3 | py | Runtime Error | 0 | 0 | 152 | import sys
s=[input()]
while(True):
n=input()
if n=="0":
print(s.pop())
elif n=="":
sys.exit()
else:
s.append(n) |
s382675037 | p00013 | u252368621 | 1479003296 | Python | Python3 | py | Runtime Error | 0 | 0 | 162 | import sys
s=[int(input())]
while(True):
n=input()
if n=="0":
print(s.pop())
elif n=="":
sys.exit()
else:
s.append(int(n)) |
s304095546 | p00013 | u205327055 | 1512997290 | Python | Python | py | Runtime Error | 0 | 0 | 214 | # coding:utf-8
syako = []
number = input()
while True:
if number != 0:
syako.append(number)
elif number == 0:
print syako.pop()
number = input()
if number == EOFError:
break |
s778374543 | p00013 | u203261375 | 1513428313 | Python | Python3 | py | Runtime Error | 0 | 0 | 178 | while True:
try:
n = int(input())
except:
break
arr = []
if n == 0:
print(arr[-1])
arr = arr[:-1]
else:
arr.append(n) |
s531654260 | p00013 | u724947062 | 1346959222 | Python | Python | py | Runtime Error | 0 | 1544 | 176 | import sys
cars = list()
for line in sys.stdin.readlines():
line = line.strip()
N = int(line)
if N != 0:
cars.append(N)
else:
print cars.pop() |
s752326855 | p00013 | u724947062 | 1346959332 | Python | Python | py | Runtime Error | 0 | 1544 | 176 | import sys
cars = list()
for line in sys.stdin.readlines():
line = line.strip()
N = int(line)
if N != 0:
cars.append(N)
else:
print cars.pop() |
s667763218 | p00013 | u724947062 | 1346959398 | Python | Python | py | Runtime Error | 0 | 1544 | 177 | import sys
cars = list()
for line in sys.stdin.readlines():
line = line.strip()
N = int(line)
if N != 0:
cars.append(N)
else:
print(cars.pop()) |
s871888014 | p00013 | u724947062 | 1346959507 | Python | Python | py | Runtime Error | 0 | 1544 | 192 | import sys
cars = list()
for line in sys.stdin.readlines():
line = line.strip()
print line
N = int(line)
if N != 0:
cars.append(N)
else:
print(cars.pop()) |
s672251385 | p00013 | u724947062 | 1347284287 | Python | Python | py | Runtime Error | 0 | 5396 | 163 | import sys
stack = list()
for line in sys.stdin.readlines():
line = line.strip()
n = int(line)
if n == 0:
print stack.pop()
else:
stack.append(n) |
s335271404 | p00013 | u724947062 | 1347284328 | Python | Python | py | Runtime Error | 0 | 5396 | 163 | import sys
stack = list()
for line in sys.stdin.readlines():
line = line.strip()
n = int(line)
if n == 0:
print stack.pop()
else:
stack.append(n) |
s158627240 | p00013 | u017525488 | 1350107069 | Python | Python | py | Runtime Error | 0 | 752 | 138 | import sys
lst = []
for line in sys.stdin:
num = int(line)
if num == 0:
print lst.pop()
else:
lst.append(num) |
s105079859 | p00013 | u017525488 | 1350107149 | Python | Python | py | Runtime Error | 0 | 752 | 138 | import sys
lst = []
for line in sys.stdin:
num = int(line)
if num == 0:
print lst.pop()
else:
lst.append(num) |
s627778925 | p00013 | u017525488 | 1350107242 | Python | Python | py | Runtime Error | 0 | 752 | 158 | import sys
lst = []
for line in sys.stdin:
num = int(line.split())
if num == 0:
print lst.pop()
else:
lst.append(num)
sys.exit(0) |
s248530839 | p00013 | u017525488 | 1350107945 | Python | Python | py | Runtime Error | 0 | 752 | 146 | import sys
lst = []
for line in sys.stdin:
num = int(line.strip())
if num == 0:
print lst.pop()
else:
lst.append(num) |
s986480804 | p00013 | u719737030 | 1351124487 | Python | Python | py | Runtime Error | 0 | 0 | 133 | import sys
list=[]
for i in sys.stdin.readlines():
if int(i) != 0:
list.append(int(i))
else:
print list.pop() |
s478791522 | p00013 | u719737030 | 1351124720 | Python | Python | py | Runtime Error | 0 | 0 | 142 | import sys
list=[]
for i in sys.stdin.readlines():
if float(i) != 0:
list.append(float(i))
else:
print int(list.pop()) |
s174292492 | p00013 | u647766105 | 1351609388 | Python | Python | py | Runtime Error | 0 | 0 | 127 | import sys
stack=[]
for i in sys.stdin:
a=int(i)
if a >0 :
stack.append(a)
else :
print stack.pop() |
s551204634 | p00013 | u647766105 | 1351609968 | Python | Python | py | Runtime Error | 0 | 0 | 166 | # -*- coding: utf-8 -*-
import sys
stack=[]
for i in sys.stdin:
a=int(i.split('\n')[0])
if a >0 :
stack.append(a)
else :
print stack.pop() |
s815866707 | p00013 | u779627195 | 1352545469 | Python | Python | py | Runtime Error | 0 | 5372 | 177 | tracks = []
while 1:
try:
c = input()
if c == 0:
print tracks.pop()
else:
tracks.append(c)
except EOFError:
break |
s417411829 | p00013 | u779627195 | 1352546207 | Python | Python | py | Runtime Error | 0 | 5440 | 177 | tracks = []
while 1:
try:
c = input()
if c == 0:
print tracks.pop()
else:
tracks.append(c)
except EOFError:
break |
s314927296 | p00013 | u779627195 | 1352549064 | Python | Python | py | Runtime Error | 0 | 5440 | 186 | tracks = []
while 1:
try:
c = int(raw_input())
if c == 0:
print tracks.pop()
else:
tracks.append(c)
except EOFError:
break |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.