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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s510583022 | p00032 | u469154576 | 1479045353 | Python | Python | py | Runtime Error | 0 | 0 | 203 | import sys
rec=rho=0
for line in sys.stdin:
"""while True:
line=raw_input()
if line=="a":
break
"""
a,b,c=map(int,line.split(","))
if a==b:
rho+=1
elif a*a+b*b==c*c:
rec+=1
print rec
print rho |
s788586225 | p00032 | u777299405 | 1481176535 | Python | Python3 | py | Runtime Error | 0 | 0 | 250 | import sys
rhombus = rectangle = 0
for line in sys.stdin:
a, b, c = map(int, input().split(","))
if c ** 2 == a ** 2 + b ** 2:
rectangle += 1
if a == b and c ** 2 != a ** 2 + b ** 2:
rhombus += 1
print(rectangle, rhombus) |
s089846542 | p00032 | u905313459 | 1496479424 | Python | Python3 | py | Runtime Error | 0 | 0 | 166 | import sys
j = [int(a)**2 + int(b)**2 - int(c)**2 for line in sys.stdin for a,b,c in line.split()]
print(len([i for i in j if not i]))
print(len([i for i in j if i])) |
s875239318 | p00032 | u905313459 | 1496479450 | Python | Python3 | py | Runtime Error | 0 | 0 | 169 | import sys
j = [int(a)**2 + int(b)**2 - int(c)**2 for line in sys.stdin for a,b,c in line.split(",")]
print(len([i for i in j if not i]))
print(len([i for i in j if i])) |
s030700737 | p00032 | u855694108 | 1504229988 | Python | Python3 | py | Runtime Error | 0 | 0 | 356 | import sys
def main():
ans = [0] * 2
for line in sys.stdin:
try:
a,b,c = map(int, line.split())
if a ** 2 + b ** 2 == c ** 2:
ans[0] += 1
else:
ans[1] += 1
except EOFError:
for a in ans:
print(a)
if __name__ == "__main__":
main() |
s015936494 | p00032 | u855694108 | 1504230371 | Python | Python3 | py | Runtime Error | 0 | 0 | 408 | import sys
def main():
ans = [0] * 2
for line in sys.stdin:
try:
a,b,c = map(int, line.split())
if a ** 2 + b ** 2 == c ** 2:
ans[0] += 1
else:
ans[1] += 1
for a in ans:
print(a)
except EOFError:
for a in ans:
print(a)
if __name__ == "__main__":
main() |
s950282794 | p00032 | u855694108 | 1504230581 | Python | Python3 | py | Runtime Error | 0 | 0 | 286 | import sys
def main():
ans = [0] * 2
for line in sys.stdin:
a,b,c = map(int, line.split())
if a ** 2 + b ** 2 == c ** 2:
ans[0] += 1
else:
ans[1] += 1
for a in ans:
print(a)
if __name__ == "__main__":
main() |
s627474424 | p00032 | u845643816 | 1509262767 | Python | Python3 | py | Runtime Error | 0 | 0 | 216 | n1 = n2 = 0
while True:
try:
a, b, c = map(int, line.split(','))
if a**2 + b**2 == c**2:
n1 += 1
elif a == b:
n2 += 1
except EOFError: break
print(n1)
print(n2) |
s046222211 | p00032 | u845643816 | 1509262885 | Python | Python3 | py | Runtime Error | 0 | 0 | 186 | # 0032
import sys
n1 = n2 = 0
for _ in sys.stdin:
a, b, c = map(int, line.split(','))
if a**2 + b**2 == c**2:
n1 += 1
elif a == b:
n2 += 1
print(n1)
print(n2) |
s602946666 | p00032 | u352394527 | 1527455521 | Python | Python3 | py | Runtime Error | 0 | 0 | 198 | while True:
try:
a, b, c = map(int, input().split(","))
rect_cnt += (a ** 2 + b ** 2 == c ** 2)
dia_cnt += (a == b)
except EOFError:
break
print(rect_cnt)
print(dia_cnt)
|
s791095336 | p00032 | u282635979 | 1364001806 | Python | Python | py | Runtime Error | 0 | 0 | 211 | rectangles = 0 ; lozenges = 0
while True:
try:
a,b,c, = map(int,raw_input().split(','))
if a*a + b*b = c*c: rectangle += 1
else:
if a = b: lozenges += 1
except: break
print rectangles ; print lozenges |
s705164688 | p00033 | u647694976 | 1556534230 | Python | Python3 | py | Runtime Error | 0 | 0 | 231 | n=int(input())
for i in range(n):
a=list(map(int,input().aplit()))
b,c=0,0
yes = True
for j in range(10):
if a[j]>b:b=a[j]
elif a[j]>c:c=a[j]
else:yes=False
print("YES" if yes else "NO")
|
s916574763 | p00033 | u633068244 | 1414861768 | Python | Python | py | Runtime Error | 0 | 0 | 197 | def s(a):
for i in a:
if i > b:
b = i
elif i > c:
c = i
else:
return False
return True
for n in range(int(raw_input())):
print "YES" if s(map(int,raw_input().split())) else "NO" |
s252067620 | p00033 | u506132575 | 1416196027 | Python | Python | py | Runtime Error | 0 | 0 | 516 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import itertools
input()
lis = list(itertools.product([False,True],repeat=10))
for s in sys.stdin:
d = map( int, s.split() )
flag = False
for e in lis:
lis_r = []
lis_l = []
for i in range(10):
if e[i]:
lis_r.append(d[i])
else:
lis_l.append(d[i])
f_r = sorted(lis_r)
f_l = sorted(lis_l)
if f_r == lis_r and f_l == lis_l:
flag = True
break
if flag:
print "YES"
else:
print "NO" |
s684455558 | p00033 | u506132575 | 1416196122 | Python | Python | py | Runtime Error | 0 | 0 | 517 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import itertools
input()
lis = list(itertools.product([False,True],repeat=10))
for s in sys.stdin:
d = map( int, s.split() )
flag = False
for e in lis:
lis_r = []
lis_l = []
for i in range(10):
if e[i]:
lis_r.append(d[i])
else:
lis_l.append(d[i])
f_r = sorted(lis_r)
f_l = sorted(lis_l)
if f_r == lis_r and f_l == lis_l:
flag = True
break
if flag:
print "YES"
else:
print "NO" |
s389571816 | p00033 | u506132575 | 1416232545 | Python | Python | py | Runtime Error | 0 | 0 | 498 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import itertools
input()
lis = list(itertools.product([False,True],repeat=10))
for s in sys.stdin:
d = map( int, s.split() )
flag = False
for e in lis:
l = [ d[i] if e[i] else -d[i] for i in xrange(10) ]
m = [ [ e for e in l if e > 0 ],[ -e for e in l if e < 0 ]]
n = 0
for e in m:
n += sum([ 1 if e[i] > e[i+1] else 0 for i in range(len(e)-1)])
if not n:
print "YES"
break
if n:
print "NO" |
s826727734 | p00033 | u379956761 | 1435561353 | Python | Python3 | py | Runtime Error | 0 | 0 | 490 | import sys
def stackBall(stackB, stackC, ball):
if len(ball) == 0:
return True
if len(stackB) == 0 or stackB[-1] < ball[0]:
stackB.append(ball.pop(0))
if stackBall(stackB, stackC, ball):
return True
if len(stackC) == 0 or stackC[-1] < ball[0]:
stackC.append(ball.pop(0))
if stackBall(stackB, stackC, ball):
return True
return False
n = input()
for _ in range(n):
ball = list(map(int, input().split()))
if stackBall([], [], ball):
print("YES")
else:
print("NO") |
s574285182 | p00033 | u338932851 | 1437039264 | Python | Python | py | Runtime Error | 0 | 0 | 993 | import sys
input = map(lambda x:x[:-1], sys.stdin.readlines())
n = int(input[0])
input = input[1:]
input = map(lambda x:x.split(' '), input)
for i in range(len(input)):
input[i] = map(lambda x:int(x), input[i])
print input
A = []
B = []
def a_can_add(e):
if ((len(A) != 0) and (A[-1] < e)) or len(A) == 0:
return True
def b_can_add(e):
if ((len(B) != 0) and (B[-1] < e)) or len(B) == 0:
return True
def a_add(e):
if (len(A) != 0) and (A[-1] < e):
A.append(e)
elif len(A) == 0:
A.append(e)
else: return False
def b_add(e):
if len(B) != 0 and (B[-1] < e):
B.append(e)
elif len(B) == 0:
B.append(e)
else: return False
for i in range(len(input)):
for j in range(10):
if a_can_add(input[i][j]):
a_add(input[i][j])
elif b_can_add(input[i][j]):
b_add(input[i][j])
if len(A) + len(B) == 10:
print "YES"
else:
print "NO" |
s887364808 | p00033 | u338932851 | 1437039421 | Python | Python | py | Runtime Error | 0 | 0 | 993 | import sys
input = map(lambda x:x[:-1], sys.stdin.readlines())
n = int(input[0])
input = input[1:]
input = map(lambda x:x.split(' '), input)
for i in range(len(input)):
input[i] = map(lambda x:int(x), input[i])
print input
A = []
B = []
def a_can_add(e):
if ((len(A) != 0) and (A[-1] < e)) or len(A) == 0:
return True
def b_can_add(e):
if ((len(B) != 0) and (B[-1] < e)) or len(B) == 0:
return True
def a_add(e):
if (len(A) != 0) and (A[-1] < e):
A.append(e)
elif len(A) == 0:
A.append(e)
else: return False
def b_add(e):
if len(B) != 0 and (B[-1] < e):
B.append(e)
elif len(B) == 0:
B.append(e)
else: return False
for i in range(len(input)):
for j in range(10):
if a_can_add(input[i][j]):
a_add(input[i][j])
elif b_can_add(input[i][j]):
b_add(input[i][j])
if len(A) + len(B) == 10:
print "YES"
else:
print "NO" |
s950610813 | p00033 | u338932851 | 1437039503 | Python | Python | py | Runtime Error | 0 | 0 | 994 | import sys
input = map(lambda x:x[:-1], sys.stdin.readlines())
n = int(input[0])
input = input[1:]
input = map(lambda x:x.split(' '), input)
for i in range(len(input)):
input[i] = map(lambda x:int(x), input[i])
#print input
A = []
B = []
def a_can_add(e):
if ((len(A) != 0) and (A[-1] < e)) or len(A) == 0:
return True
def b_can_add(e):
if ((len(B) != 0) and (B[-1] < e)) or len(B) == 0:
return True
def a_add(e):
if (len(A) != 0) and (A[-1] < e):
A.append(e)
elif len(A) == 0:
A.append(e)
else: return False
def b_add(e):
if len(B) != 0 and (B[-1] < e):
B.append(e)
elif len(B) == 0:
B.append(e)
else: return False
for i in range(len(input)):
for j in range(10):
if a_can_add(input[i][j]):
a_add(input[i][j])
elif b_can_add(input[i][j]):
b_add(input[i][j])
if len(A) + len(B) == 10:
print "YES"
else:
print "NO" |
s454371737 | p00033 | u560214129 | 1450513299 | Python | Python3 | py | Runtime Error | 0 | 0 | 727 | a=[]
n=int(input())
for i in range(10):
a.append(-1)
while(n!=0):
b=[]
c=[]
a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9]=map(int,input().split())
for i in range(10):
b.append(-1)
c.append(-1)
j=1
k=0
lenb=0
lenc=0
b[0]=a[0]
for i in range(1,10):
if(a[i]>b[j-1]):
b[j]=a[i]
j+=1
else:
if(k==0):
c[0]=a[i]
k+=1
elif(a[i]>c[k-1]):
c[k]=a[i]
k+=1
for i in range(10):
if(b[i]!=-1):
lenb+=1
if(c[i]!=-1):
lenc+=1
if(len(a)==(lenb+lenc)):
print("YES")
else:
print("NO") |
s062592221 | p00033 | u130979865 | 1460812469 | Python | Python | py | Runtime Error | 0 | 0 | 489 | # -*- coding: utf-8 -*-
n = int(raw_input())
for i in range(n):
A = map(int, raw_input().split())
B = []
C = []
flag = True
for i in range(5):
B.append(A[2*i])
C.append(A[2*i+1])
for i in range(4):
for j in range(i+1, 4)
if B[j] > B[i]:
flag = False
break
if C[ij > C[i]:
flag = False
break
if flag:
print "YES"
else:
print "NO" |
s262027575 | p00033 | u130979865 | 1460812509 | Python | Python | py | Runtime Error | 0 | 0 | 489 | # -*- coding: utf-8 -*-
n = int(raw_input())
for i in range(n):
A = map(int, raw_input().split())
B = []
C = []
flag = True
for i in range(5):
B.append(A[2*i])
C.append(A[2*i+1])
for i in range(4):
for j in range(i+1, 5)
if B[j] > B[i]:
flag = False
break
if C[j] > C[i]:
flag = False
break
if flag:
print "YES"
else:
print "NO" |
s302131916 | p00033 | u130979865 | 1460813644 | Python | Python | py | Runtime Error | 0 | 0 | 382 | # -*- coding: utf-8 -*-
n = int(raw_input())
for i in range(n):
A, B, C = [], [0], [0]
A = map(int, raw_input().split())
for i in range(10):
if num[i] > A[0]:
A.insert(0, num[i])
elif num[i] > B[0]:
B.insert(0, num[i])
else:
break
if len(A) + len(B) == 12:
print "YES"
else:
print "NO" |
s951378583 | p00033 | u130979865 | 1460813694 | Python | Python | py | Runtime Error | 0 | 0 | 378 | # -*- coding: utf-8 -*-
n = int(raw_input())
for i in range(n):
A, B, C = [], [0], [0]
A = map(int, raw_input().split())
for i in range(10):
if A[i] > B[0]:
B.insert(0, num[i])
elif A[i] > C[0]:
C.insert(0, num[i])
else:
break
if len(A) + len(B) == 12:
print "YES"
else:
print "NO" |
s098214101 | p00033 | u379499530 | 1473217419 | Python | Python | py | Runtime Error | 0 | 0 | 231 | N = input()
for i in xrange(N):
b, c = 0, 0
for j in map(int, raw_input().split()):
if b[-1] < j: b = j
elif c[-1] < j: c = j
else: break
else:
print 'YES'
continue
print 'NO' |
s171882828 | p00033 | u777299405 | 1481180133 | Python | Python3 | py | Runtime Error | 0 | 0 | 382 | n = int(input())
for i in range(n):
left = right = []
arr = map(int, input().split())
for a in arr:
if len(left) == 0 or left[-1] < a:
left.append(a)
elif len(right) == 0 or right[-1] < a:
right.append(a)
else:
break
if len(arr) == len(left) + len(right):
print("YES")
else:
print("NO") |
s696280355 | p00033 | u661290476 | 1482453864 | Python | Python3 | py | Runtime Error | 0 | 0 | 326 | ans=0
def solve(n,left,right):
if n==10:
ans=1
else:
if a[n]>left:
ans=solve(n+1,a[n],right)
if a[n]>right:
ans=solve(n+1,left,a[n])
return ans
n=int(input())
for _ in range(n):
a=[int(i) for i in input().split()]
print("YES" if solve(0,0,0) else "NO")
|
s507145810 | p00033 | u940389926 | 1493719423 | Python | Python3 | py | Runtime Error | 0 | 0 | 834 | def load_balls():
LINE_NUM, TOTAL = 0, 0
balls = []
i = 0
for line in sys.stdin:
line = line.strip()
LINE_NUM += 1
if LINE_NUM == 1:
TOTAL = int(line.strip())
continue
balls.append([int(i) for i in line.split(" ")])
if LINE_NUM == TOTAL+1: break
return balls
class VesselClass:
def __init__(self):
self.BALL_NUM = 10
self.tmp = []
self.left = [0]
self.right = [0]
def fill(self, balls:list):
self.tmp = balls
def DFS(self):
if len(self.tmp) == 0: print("Yes")
elif self.left[-1] < self.tmp[0]:
self.left.append(self.tmp[0])
self.tmp.pop(0)
self.DFS()
elif self.right[-1] < self.tmp[0]:
self.right.append(self.tmp[0])
self.tmp.pop(0)
self.DFS()
else: print("No")
balls_list = load_balls()
Vessel = VesselClass()
for balls in balls_list:
Vessel.fill(balls)
Vessel.DFS() |
s074635966 | p00033 | u940389926 | 1493719467 | Python | Python3 | py | Runtime Error | 0 | 0 | 834 | def load_balls():
LINE_NUM, TOTAL = 0, 0
balls = []
i = 0
for line in sys.stdin:
line = line.strip()
LINE_NUM += 1
if LINE_NUM == 1:
TOTAL = int(line.strip())
continue
balls.append([int(i) for i in line.split(" ")])
if LINE_NUM == TOTAL+1: break
return balls
class VesselClass:
def __init__(self):
self.BALL_NUM = 10
self.tmp = []
self.left = [0]
self.right = [0]
def fill(self, balls:list):
self.tmp = balls
def DFS(self):
if len(self.tmp) == 0: print("Yes")
elif self.left[-1] < self.tmp[0]:
self.left.append(self.tmp[0])
self.tmp.pop(0)
self.DFS()
elif self.right[-1] < self.tmp[0]:
self.right.append(self.tmp[0])
self.tmp.pop(0)
self.DFS()
else: print("No")
balls_list = load_balls()
Vessel = VesselClass()
for balls in balls_list:
Vessel.fill(balls)
Vessel.DFS() |
s067087895 | p00033 | u845643816 | 1512296992 | Python | Python3 | py | Runtime Error | 0 | 0 | 314 | n = int(input())
for i in range(n):
arr = map(int, input().split())
b,c = 0,0
for i in range(len(arr)):
if b < arr[i]:
b = arr[i]
continue
if c < arr[i]:
c = arr[i]
continue
print("NO")
break
else:
print("YES") |
s328716154 | p00033 | u845643816 | 1512297006 | Python | Python3 | py | Runtime Error | 0 | 0 | 354 | n = int(input())
for i in range(n):
arr = map(int, input().split())
b,c = 0,0
flag = True
for i in range(len(arr)):
if b < arr[i]:
b = arr[i]
continue
if c < arr[i]:
c = arr[i]
continue
print("NO")
flag = False
break
if flag:
print("YES") |
s849389816 | p00033 | u845643816 | 1512297734 | Python | Python3 | py | Runtime Error | 0 | 0 | 333 | def ball(nums):
????????b,c = 0,0
for i in range(len(a)):
if b < a[i]:
b = a[i]
continue
if c < a[i]:
c = a[i]
continue
return "NO"
return "YES"
??
N = int(input())
??
for _ in range(N):
????????a = list(map(int, input().split()))
????????print(ball(a)) |
s678717082 | p00033 | u299798926 | 1518179053 | Python | Python3 | py | Runtime Error | 0 | 0 | 305 | x=int(input())
for i in range(x):
num=[int(i) for i in input().split()]
b=[]
c=[]
flag=0
b.append(num[0])
c.append(int(0))
for i in range(1,10):
if b[0]<num[i]:
b.append(num[i])
elif c[0]<num[i]:
c.append(num[i])
else:
flag=1
break
if flag==:
print("YES")
else:
print("No")
|
s109254283 | p00033 | u299798926 | 1518180669 | Python | Python3 | py | Runtime Error | 0 | 0 | 214 | x=int(input())
for _ in range(x):
num=list(map(int,input().split()))
b,c=0,0
flag=True
for d in num:
if b < d:
b=i
elif c<i:
c=i
else:
print("NO")
flag=False
break
if flag:
print("YES")
|
s819776589 | p00033 | u352394527 | 1527483967 | Python | Python3 | py | Runtime Error | 0 | 0 | 646 | #数列に対しy/nの判定をする
def solve(balls):
#B, Cの一番上の数(ただし常にB <= Cを保つ)
last_b = last_c = 0
while balls:
new = balls.pop(0)
#new <= last_b <= last_c --> 不可能
if new <= last_b:
print("NO")
break
#last_b < new <= last_c --> Bを更新
elif new <= last_c:
last_b = new
#last_b < last_c < new --> Cを更新
else:
last_c = new
else:
print("YES")
while True:
try:
n = int(input())
for i in range(n):
balls = list(map(int, input().split()))
solve(balls)
except EOFError:
break
|
s317008972 | p00033 | u282635979 | 1363788943 | Python | Python | py | Runtime Error | 0 | 0 | 458 | N = input() + 1
for val in range(1,N):
branches = [[0] for x in range(0,10)]
x = map(int,raw_input().split(' '))
branches[0].append(x[0])
branch_num = 1
for l in range(2,10):
small_num = 0
for n in range(0,l):
if branches[n][0] < x[]
small_num += 1
if small_num == 0:
branches[l].insert[0,x[l]]
branch_num = 0
for val in range(0,10):
if branches[val][0] == 0:
branch_num += 1
if blanch_num <= 2:
print 'YES'
else:
print 'NO' |
s410368943 | p00033 | u542421762 | 1368281557 | Python | Python | py | Runtime Error | 0 | 0 | 547 |
import sys
def fill_balls(a):
b = [0]
c = [0]
for ball in a:
if b[-1] == 0:
b.append(ball)
elif b[-1] < ball and c[-1] < ball:
if b[-1] < c[-1]:
c.append(ball)
else:
b.append(ball)
elif b[-1] < ball:
b.append(ball)
elif c[-1] < ball:
c.append(ball)
else:
return 'NO'
return 'YES'
sys.stdin.readline()
for line in sys.stdin:
a = map(int, line.split(' '))
print fill_balls(a) |
s124890383 | p00033 | u147801965 | 1375079469 | Python | Python | py | Runtime Error | 0 | 0 | 395 | for i in range(input()):
q,w=[0],[0]
flag=0
_L=map(int,raw_input().split())
q.append(_L[0])
for j in _L[1:]:
if q[-1] > w[-1]:
if q[-1] < j: q.append(j)
elif w[-1] < j: w.append(j)
else:
flag=1
break
if q[-1] < w[-1]:
if w[-1] < j: w.append(j)
elif q[-1] < j: q.append(j)
else:
flag=1
break
print "YES" if flag==0 else "NO" |
s727260596 | p00033 | u633068244 | 1393577281 | Python | Python | py | Runtime Error | 0 | 0 | 319 | def check(x):
a, b = 0, 0
for ball in x:
if a > ball:
a = ball
elif b > ball:
b = ball
else:
return False
return True
n = int(raw_input())
for i in range(n):
all = map(int, raw_input().split())
print "YES" if check(all) else print "NO" |
s874149265 | p00033 | u633068244 | 1393577615 | Python | Python | py | Runtime Error | 0 | 0 | 294 | def d(a):
b, c = 0, 0
for ball in x:
if b < a:
b = a
elif c < a:
c = a
else:
return False
return True
n = int(raw_input())
for i in range(n):
all = map(int, raw_input().split())
print "YES" if d(all) else "NO" |
s617477754 | p00034 | u525366883 | 1535687805 | Python | Python | py | Runtime Error | 0 | 0 | 270 | while True:
try:
l = map(int, raw_input().split(","))
v1 = l.pop(10)
v2 = l.pop(10)
p = v1*float(sum(l))/(v1+v2)
for i in range(10):
p -= l[i]
if p <= 0:
print i+1
break
|
s323688848 | p00034 | u525366883 | 1535687875 | Python | Python | py | Runtime Error | 0 | 0 | 299 | while True:
try:
l = map(int, raw_input().split(","))
v1 = l.pop(10)
v2 = l.pop(10)
p = v1*float(sum(l))/(v1+v2)
for i in range(10):
p -= l[i]
if p <= 0:
print i+1
break
except:
break
|
s568981139 | p00034 | u525366883 | 1535687888 | Python | Python | py | Runtime Error | 0 | 0 | 302 | while True:
try:
l = map(int, raw_input().split(","))
v1 = l.pop(10)
v2 = l.pop(10)
p = v1*float(sum(l))/(v1+v2)
for i in range(10):
p -= l[i]
if p <= 0:
print i+1
break
except:
break
|
s183817579 | p00034 | u525366883 | 1535687902 | Python | Python | py | Runtime Error | 0 | 0 | 301 | while True:
try:
l = map(int, raw_input().split(","))
v1 = l.pop(10)
v2 = l.pop(10)
p = v1*float(sum(l))/(v1+v2)
for i in range(10):
p -= l[i]
if p <= 0:
print i+1
break
except:
break
|
s240947191 | p00034 | u733620181 | 1410227007 | Python | Python | py | Runtime Error | 0 | 0 | 396 | while True:
try:
line = map(int, raw_input().split(","))
except:
break
sum = 0
rail = []
for x in line[0:10]:
sum += x
rail.append(sum)
# sum: レールの総距離
# rail: スタートから各ポイントまでの距離
cross = sum * (line[10] * 1.0 / (line[10] + line[11]))
for i, length in enumerate(rail):
if cross <= length:
print i+1
break |
s797401230 | p00034 | u744114948 | 1521170588 | Python | Python3 | py | Runtime Error | 0 | 0 | 267 | while True:
try:
l = list(map(int, input().split(",")))
except ValueError:
break
sum_l = sum(l[:10])
M = sum_l*l[10]/(l[10] + l[11])
for i in range(10):
if M <= 0:
print(i)
break
M -= l[i]
|
s331428904 | p00034 | u459861655 | 1349743426 | Python | Python | py | Runtime Error | 0 | 1856 | 270 | while True:
t = raw_input().split(',')
l = [int(x) for x in t[:10]]
v = [int(x) for x in t[10:]]
time = float(sum(l)) / float(sum(v))
dis = time * float(v[0])
s = 0
for (i, x) in enumerate(l):
s += x
if s >= int(dis):
print i + 1
break |
s321642712 | p00035 | u148101999 | 1459408687 | Python | Python | py | Runtime Error | 0 | 0 | 652 | #encoding=utf-8
import sys
def inp():
for i in sys.stdin:
xa,ya,xb,yb,xc,yc,xd,yd = map(float, i.split(","))
print hantei(xa,ya,xb,yb,xc,yc,xd,yd)
def hantei(xa,ya,xb,yb,xc,yc,xd,yd):
count = [0,0,0,0]
a1 = (ya - yc)/(xa - yc)
b1 = ya - a1*xa
a2 = (yb - yd)/(xb - xd)
b2 = yb - a2*xb
if xb*a1+b1 > yb:
count[0] += 1
else:
count[1] += 1
if xd*a1+b1 > yd:
count[0] += 1
else:
count[1] += 1
if xa*a2+b2 > ya:
count[2] += 1
else:
count[3] += 1
if xc*a2+b2 > yc:
count[2] += 1
else:
count[3] += 1
for i in xrange(4):
if count[i] != 1:
return "NO"
else:
pass
return "YES"
if __name__ == "__main__":
inp() |
s211691366 | p00035 | u148101999 | 1459409036 | Python | Python | py | Runtime Error | 0 | 0 | 636 | import sys
def inp():
for i in sys.stdin:
xa,ya,xb,yb,xc,yc,xd,yd = map(float, i.split(","))
print hantei(xa,ya,xb,yb,xc,yc,xd,yd)
def hantei(xa,ya,xb,yb,xc,yc,xd,yd):
count = [0,0,0,0]
a1 = (ya - yc)/(xa - yc)
b1 = ya - a1*xa
a2 = (yb - yd)/(xb - xd)
b2 = yb - a2*xb
if xb*a1+b1 > yb:
count[0] += 1
else:
count[1] += 1
if xd*a1+b1 > yd:
count[0] += 1
else:
count[1] += 1
if xa*a2+b2 > ya:
count[2] += 1
else:
count[3] += 1
if xc*a2+b2 > yc:
count[2] += 1
else:
count[3] += 1
for i in xrange(4):
if count[i] != 1:
return "NO"
else:
pass
return "YES"
if __name__ == "__main__":
inp() |
s984506195 | p00035 | u148101999 | 1459409334 | Python | Python | py | Runtime Error | 0 | 0 | 624 | #encoding=utf-8
import sys
def inp():
for i in sys.stdin:
xa,ya,xb,yb,xc,yc,xd,yd = map(float, i.split(","))
print hantei(xa,ya,xb,yb,xc,yc,xd,yd)
def hantei(xa,ya,xb,yb,xc,yc,xd,yd):
count = [0,0,0,0]
a1 = (ya - yc)/(xa - yc)
b1 = ya - a1*xa
a2 = (yb - yd)/(xb - xd)
b2 = yb - a2*xb
if xb*a1+b1 > yb:
count[0] += 1
else:
count[1] += 1
if xd*a1+b1 > yd:
count[0] += 1
else:
count[1] += 1
if xa*a2+b2 > ya:
count[2] += 1
else:
count[3] += 1
if xc*a2+b2 > yc:
count[2] += 1
else:
count[3] += 1
for i in xrange(4):
if count[i] != 1:
return "NO"
else:
pass
return "YES"
inp() |
s289395203 | p00035 | u148101999 | 1459409484 | Python | Python | py | Runtime Error | 0 | 0 | 604 | #encoding=utf-8
import sys
def hantei(xa,ya,xb,yb,xc,yc,xd,yd):
count = [0,0,0,0]
a1 = (ya - yc)/(xa - yc)
b1 = ya - a1*xa
a2 = (yb - yd)/(xb - xd)
b2 = yb - a2*xb
if xb*a1+b1 > yb:
count[0] += 1
else:
count[1] += 1
if xd*a1+b1 > yd:
count[0] += 1
else:
count[1] += 1
if xa*a2+b2 > ya:
count[2] += 1
else:
count[3] += 1
if xc*a2+b2 > yc:
count[2] += 1
else:
count[3] += 1
for i in xrange(4):
if count[i] != 1:
return "NO"
else:
pass
return "YES"
for i in sys.stdin:
xa,ya,xb,yb,xc,yc,xd,yd = map(float, i.split(","))
print hantei(xa,ya,xb,yb,xc,yc,xd,yd) |
s107824636 | p00035 | u711765449 | 1484915090 | Python | Python3 | py | Runtime Error | 0 | 0 | 1091 | import math
def get_data():
xa,ya,xb,yb,xc,yc,xd,yd = map(float,input().split(','))
return xa,ya,xb,yb,xc,yc,xd,yd
def dist(x1,y1,x2,y2):
d = ((x2-x1)**2 + (y2-y1)**2)**0.5
return d
def lin(x1,y1,x2,y2):
m = (y1-y2)/(x1-x2)
n = (x1*y2-x2*y1)/(x1-x2)
return m,n
def p_l(x0,y0,m,n):
d = abs(y0-m*x0-n)/math.sqrt(1+m**2)
return d
def convex(xa,ya,xb,yb,xc,yc,xd,yd):
ac = dist(xa,ya,xc,yc)
bd = dist(xb,yb,xd,yd)
m1,n1 = lin(xb,yb,xd,yd)
d1 = p_l(xa,ya,m1,n1)
if ac < d1:
print('NO')
return 0
m2,n2 = lin(xb,yb,xd,yd)
d2 = p_l(xc,yc,m2,n2)
if ac < d2:
print('NO')
return 0
m3,n3 = lin(xa,ya,xc,yc)
d3 = p_l(xb,yb,m3,n3)
if bd < d3:
print('NO')
return 0
m4,n4 = lin(xa,ya,xc,yc)
d4 = p_l(xd,yd,m4,n4)
if bd < d4:
print('NO')
return 0
else:
print('YES')
return 0
while True:
try:
xa,ya,xb,yb,xc,yc,xd,yd = get_data()
convex(xa,ya,xb,yb,xc,yc,xd,yd)
except EOFError:
break |
s875438232 | p00035 | u711765449 | 1484915407 | Python | Python3 | py | Runtime Error | 0 | 0 | 1082 | import math
def get_data():
xa,ya,xb,yb,xc,yc,xd,yd = map(float,input().split(','))
return xa,ya,xb,yb,xc,yc,xd,yd
def dist(x1,y1,x2,y2):
d = ((x2-x1)**2 + (y2-y1)**2)**0.5
return d
def lin(x1,y1,x2,y2):
m = (y1-y2)/(x1-x2)
n = (x1*y2-x2*y1)/(x1-x2)
return m,n
def p_l(x0,y0,m,n):
d = abs(y0-m*x0-n)/math.sqrt(1+m**2)
return d
def convex(xa,ya,xb,yb,xc,yc,xd,yd):
ac = dist(xa,ya,xc,yc)
bd = dist(xb,yb,xd,yd)
m1,n1 = lin(xb,yb,xd,yd)
d1 = p_l(xa,ya,m1,n1)
if ac < d1:
print('NO')
return 0
m2,n2 = lin(xb,yb,xd,yd)
d2 = p_l(xc,yc,m2,n2)
if ac < d2:
print('NO')
return 0
m3,n3 = lin(xa,ya,xc,yc)
d3 = p_l(xb,yb,m3,n3)
if bd < d3:
print('NO')
return 0
m4,n4 = lin(xa,ya,xc,yc)
d4 = p_l(xd,yd,m4,n4)
if bd < d4:
print('NO')
return 0
print('YES')
return 0
while True:
try:
xa,ya,xb,yb,xc,yc,xd,yd = get_data()
convex(xa,ya,xb,yb,xc,yc,xd,yd)
except EOFError:
break |
s547960223 | p00035 | u711765449 | 1484915926 | Python | Python3 | py | Runtime Error | 0 | 0 | 940 | import math
def get_data():
xa,ya,xb,yb,xc,yc,xd,yd = map(float,input().split(','))
return xa,ya,xb,yb,xc,yc,xd,yd
def dist(x1,y1,x2,y2):
d = ((x2-x1)**2 + (y2-y1)**2)**0.5
return d
def lin(x1,y1,x2,y2):
if x1 == x2:
m = 10000000000 ac = dist(xa,ya,xc,yc)
bd = dist(xb,yb,xd,yd)
m1,n1 = lin(xb,yb,xd,yd)
d1 = p_l(xa,ya,m1,n1)
if ac < d1:
print('NO')
return 0
m2,n2 = lin(xb,yb,xd,yd)
d2 = p_l(xc,yc,m2,n2)
if ac < d2:
print('NO')
return 0
m3,n3 = lin(xa,ya,xc,yc)
d3 = p_l(xb,yb,m3,n3)
if bd < d3:
print('NO')
return 0
m4,n4 = lin(xa,ya,xc,yc)
d4 = p_l(xd,yd,m4,n4)
if bd < d4:
print('NO')
return 0
print('YES')
return 0
while True:
try:
xa,ya,xb,yb,xc,yc,xd,yd = get_data()
convex(xa,ya,xb,yb,xc,yc,xd,yd)
except EOFError:
break |
s318780414 | p00035 | u905313459 | 1496486453 | Python | Python3 | py | Runtime Error | 0 | 0 | 302 | import sys
for line in sys.stdin():
p = list(map(float, line.split(',')))
v = [p[i] - p[(i + 2) % 8] for i in range(8)]
ip = [v[j] * v[(j + 3) % 8] - v[j + 1] * v[(j + 2) % 8] > 0 for j in range(0,8,2)]
if sum(ip) == 0 or sum(ip) == 4:
print('YES')
else:
print('NO') |
s864622650 | p00035 | u905313459 | 1496486471 | Python | Python3 | py | Runtime Error | 0 | 0 | 302 | import sys
for line in sys.stdin():
p = list(map(float, line.split(',')))
v = [p[i] - p[(i + 2) % 8] for i in range(8)]
ip = [v[j] * v[(j + 3) % 8] - v[j + 1] * v[(j + 2) % 8] > 0 for j in range(0,8,2)]
if sum(ip) == 0 or sum(ip) == 4:
print('YES')
else:
print('NO') |
s032364753 | p00035 | u724963150 | 1496511787 | Python | Python3 | py | Runtime Error | 0 | 0 | 1468 | class Vector2:
"""
A simple 2D vector class.
@Author:whitestone0811(Vir_MeL0)
"""
def __init__(self,x,y):
self.x=x
self.y=y
def __add__(self,other):
return Vector2(self.x+other.x,self.y+other.y)
def __sub__(self,other):
return Vector2(self.x-other.x,self.y-other.y)
def __mul__(self,other):
if isinstance(other, Vector2):
return self.x*other.x+self.y*other.y
else:
return Vector2(self.x*other,self.y*other)
def __rmul__(self,other):
if not isinstance(other,Vector2):
return Vector2(self.x*other,self.y*other)
def abs(self):
return (self.x**2+self.y**2)**0.5
def cos(self,other):
return (self*other)/(self.abs()*other.abs())
def __str__(self):
return "[{0},{1}]".format(self.x,self.y)
def __neg__(self):
return Vector2(-self.x,-self.y)
#
_in=input()
while _in!='':
cors=[float(cor)for cor in _in.split(',')]
vAB=Vector2(cors[2]-cors[0],cors[3]-cors[1])
vBC=Vector2(cors[4]-cors[2],cors[5]-cors[3])
vCD=Vector2(cors[6]-cors[4],cors[7]-cors[5])
vDA=Vector2(cors[0]-cors[6],cors[1]-cors[7])
cnv_a=True if(vAB-vDA)*(vAB+vBC)>0 else False
cnv_b=True if(vBC-vAB)*(vBC+vCD)>0 else False
cnv_c=True if(vCD-vBC)*(vCD+vDA)>0 else False
cnv_d=True if(vDA-vCD)*(vDA+vAB)>0 else False
print("YES" if cnv_a and cnv_b and cnv_c and cnv_d else "NO")
_in=input() |
s759069250 | p00035 | u459861655 | 1350367185 | Python | Python | py | Runtime Error | 0 | 6128 | 391 | def cross(p0, p1, p2):
dx1, dx2 = p1[0] - p0[0], p2[0] - p0[0]
dy1, dy2 = p1[1] - p0[1], p2[1] - p0[1]
return True if dy2 * dx1 > dy1 * dx2 else False
while True:
l = [float(x) for x in raw_input().split(',')]
a = l[0:2]
b = l[2:4]
c = l[4:6]
d = l[6:8]
if((cross(a, c, b) != cross(a, c, d)) and (cross(b, d, a) != cross(b, d, c))):
print 'YES'
else:
print 'NO' |
s981008818 | p00035 | u459861655 | 1350487550 | Python | Python | py | Runtime Error | 0 | 0 | 367 | def cross(p0, p1, p2):
dx1, dx2 = p1[0] - p0[0], p2[0] - p0[0]
dy1, dy2 = p1[1] - p0[1], p2[1] - p0[1]
return dy2 * dx1 - dy1 * dx2
while True:
line = raw_input()
l = [float(r) for r in line.split(',')]
a, b, c, d = l[0:2], l[2:4], l[4:6], l[6:8]
print 'YES' if (cross(a, c, b) * cross(a, c, d)) < 0 and (cross(b, d, a) * cross(b, d, c) < 0) else 'NO' |
s658896047 | p00035 | u782850731 | 1362773900 | Python | Python | py | Runtime Error | 0 | 0 | 632 | from __future__ import (division, absolute_import, print_function,
unicode_literals)
from sys import stdin
from collections import namedtuple
Point = namedtuple('Point', 'x y')
def make_test(p1, p2):
gradient = (p1.y - p2.y) / (p1.x - p2.x)
y_intercept = p1.y - gradient * p1.x
return lambda p: gradient * p.x + y_intercept > p.y
for line in stdin:
it = (float(s) for s in line.split(','))
A, B, C, D = (Point(next(it), next(it)) for _ in xrange(4))
f = make_test(A, C)
g = make_test(B, D)
if f(B) == f(D) or g(A) == g(C):
print('NO')
else:
print('YES') |
s539750593 | p00035 | u912237403 | 1394324707 | Python | Python | py | Runtime Error | 0 | 0 | 389 | import sys
def sign(x):
if x>0: s=1
elif x<0: s=-1
else s=0
return s
def f(p1,p2,p3):
x1,y1 = p1
s = sign((p3[1]-y1)*(p2[0]-x1)-(p2[1]-y1)*(p3[0]-x1))
return s
for s in sys.stdin:
D = map(float, s.split(","))
p1 = D[0:2]; p2 = D[2:4]; p3 = D[4:6]; p4 = D[6:8]
x = f(p1,p3,p2) != f(p1,p3,p4) and f(p2,p4,p1) != f(p2,p4,p3)
print ["NO","YES"][x] |
s262854532 | p00035 | u912237403 | 1394324753 | Python | Python | py | Runtime Error | 0 | 0 | 389 | import sys
def sign(x):
if x>0: s=1
elif x<0: s=-1
else s=0
return s
def f(p1,p2,p3):
x1,y1 = p1
s = sign((p3[1]-y1)*(p2[0]-x1)-(p2[1]-y1)*(p3[0]-x1))
return s
for s in sys.stdin:
D = map(float, s.split(","))
p1 = D[0:2]; p2 = D[2:4]; p3 = D[4:6]; p4 = D[6:8]
x = f(p1,p3,p2) != f(p1,p3,p4) and f(p2,p4,p1) != f(p2,p4,p3)
print ["NO","YES"][x] |
s826572184 | p00035 | u912237403 | 1394324818 | Python | Python | py | Runtime Error | 0 | 0 | 379 | import sys
def sign(x):
if x>0: s=1
elif x<0: s=-1
else s=0
return s
def f(p1,p2,p3):
x1,y1 = p1
s = sign((p3[1]-y1)*(p2[0]-x1)-(p2[1]-y1)*(p3[0]-x1))
return s
for s in sys.stdin:
D = map(float, s.split(","))
p1 = D[0:2]; p2 = D[2:4]; p3 = D[4:6]; p4 = D[6:8]
print ["NO","YES"][f(p1,p3,p2) != f(p1,p3,p4) and f(p2,p4,p1) != f(p2,p4,p3)] |
s546604734 | p00036 | u873482706 | 1434689337 | Python | Python | py | Runtime Error | 0 | 0 | 1188 | def university(xxx, pattern):
tate = 0
yoko = 1
for current_tate in range(8-xxx[tate]+1):
for current_yoko in range(8-xxx[yoko]+1):
if absolutely_fantastic(current_tate, current_yoko):
return True
def absolutely_fantastic(current_tate, current_yoko):
tate = 0
yoko = 1
run = []
for add_tate in range(xxx[tate]):
for add_yoko in range(xxx[yoko]):
run.append(mapppp[current_tate+add_tate][current_yoko+add_yoko])
if run == pattern:
print xxx[2]
return True
A = {(2,2,'A'):[1,1,1,1]}
B = {(4,1,'B'):[1,1,1,1]}
C = {(1,4,'C'):[1,1,1,1]}
D = {(3,2,'D'):[0,1,1,1,1,0]}
E = {(2,3,'E'):[1,1,0,0,1,1]}
F = {(3,2,'F'):[1,0,1,1,0,1]}
G = {(2,3,'G'):[0,1,1,1,1,0]}
lis = [A,B,C,D,E,F,G]
mapppp = []
while True:
input_line = raw_input()
if input_line:
yoko = [int(char) for char in input_line]
mapppp.append(yoko)
else:
for XXX in lis:
flag = False
for xxx, pattern in XXX.items():
if university(xxx, pattern):
flag = True
break
if flag == True:
break |
s806698118 | p00036 | u873482706 | 1434689962 | Python | Python | py | Runtime Error | 0 | 0 | 1170 | def university(xxx, pattern):
tate = 0
yoko = 1
for current_tate in range(8-xxx[tate]+1):
for current_yoko in range(8-xxx[yoko]+1):
if absolutely_fantastic(current_tate, current_yoko):
return True
def absolutely_fantastic(current_tate, current_yoko):
tate = 0
yoko = 1
run = []
for add_tate in range(xxx[tate]):
for add_yoko in range(xxx[yoko]):
run.append(mapppp[current_tate+add_tate][current_yoko+add_yoko])
if run == pattern:
print xxx[2]
return True
A = {(2,2,'A'):[1,1,1,1]}
B = {(4,1,'B'):[1,1,1,1]}
C = {(1,4,'C'):[1,1,1,1]}
D = {(3,2,'D'):[0,1,1,1,1,0]}
E = {(2,3,'E'):[1,1,0,0,1,1]}
F = {(3,2,'F'):[1,0,1,1,0,1]}
G = {(2,3,'G'):[0,1,1,1,1,0]}
lis = [A,B,C,D,E,F,G]
mapppp = []
while True:
for i in range(8):
input_line = raw_input()
yoko = [int(char) for char in input_line]
mapppp.append(yoko)
for XXX in lis:
flag = False
for xxx, pattern in XXX.items():
if university(xxx, pattern):
flag = True
break
if flag == True:
break
raw_input() |
s485257095 | p00036 | u379956761 | 1435648003 | Python | Python3 | py | Runtime Error | 0 | 0 | 519 | import sys
for s in sys.stdin:
sur = [list(map(int, s.strip()))]
if 1 not in sur[0]:
sur.pop()
for _ in range(7):
sur.append(list(map(int, input().strip())))
if 1 not in sur[-1]:
sur.pop()
if len(sur) == 1:
print("C")
elif len(sur) == 2:
if sur[0].index(1) == sur[1].index(1):
print("A")
elif sur[0].index(1) < sur[1].index(1):
print("E")
else:
print("G")
elif len(sur) == 3:
if sur[0].index(1) > sur[2].index(1):
print("D")
else:
print("F")
elif len(sur) == 4:
print("B") |
s513540524 | p00036 | u379956761 | 1435648987 | Python | Python3 | py | Runtime Error | 0 | 0 | 519 | import sys
for s in sys.stdin:
sur = [list(map(int, s.strip()))]
if 1 not in sur[0]:
sur.pop()
for _ in range(7):
sur.append(list(map(int, input().strip())))
if 1 not in sur[-1]:
sur.pop()
if len(sur) == 1:
print("C")
elif len(sur) == 2:
if sur[0].index(1) == sur[1].index(1):
print("A")
elif sur[0].index(1) < sur[1].index(1):
print("E")
else:
print("G")
elif len(sur) == 3:
if sur[0].index(1) > sur[2].index(1):
print("D")
else:
print("F")
elif len(sur) == 4:
print("B") |
s657890721 | p00036 | u489809100 | 1446624223 | Python | Python | py | Runtime Error | 0 | 0 | 917 | while True:
try:
code = [raw_input() for _ in range(8)]
except EOFError:
break
code = "".join(code)
check = 0
for var in range(0, len(code)):
if int(code[var:var+1]) == 1:
check = var
break
if int(code[check+1:check+2]) == 1 and int(code[check+8:check+9]) == 1:
if int(code[check+9:check+10]) == 1:
print "A"
if int(code[check+7:check+8]) == 1:
print "G"
elif int(code[check+1:check+2]) == 1:
if int(code[check+2:check+3]) == 1 and int(code[check+3:check+4]) == 1:
print "C"
if int(code[check+9:check+10]) == 1 and int(code[check+10:check+11]) == 1:
print "E"
elif int(code[check+8:check+9]) == 1:
if int(code[check+16:check+17]) == 1 and int(code[check+24:check+25]) == 1:
print "B"
if int(code[check+7:check+8]) == 1 and int(code[check+15:check+16]) == 1:
print "D"
if int(code[check+9:check+10]) == 1 and int(code[check+17:check+18]) == 1:
print "F" |
s794340974 | p00036 | u489809100 | 1446624695 | Python | Python | py | Runtime Error | 0 | 0 | 928 | while True:
try:
code = [raw_input() for _ in range(8)]
except EOFError:
break
code = "".join(code)
str(code)
check = 0
for var in range(0, len(code)):
if int(code[var:var+1]) == 1:
check = var
break
if int(code[check+1:check+2]) == 1 and int(code[check+8:check+9]) == 1:
if int(code[check+9:check+10]) == 1:
print "A"
if int(code[check+7:check+8]) == 1:
print "G"
elif int(code[check+1:check+2]) == 1:
if int(code[check+2:check+3]) == 1 and int(code[check+3:check+4]) == 1:
print "C"
if int(code[check+9:check+10]) == 1 and int(code[check+10:check+11]) == 1:
print "E"
elif int(code[check+8:check+9]) == 1:
if int(code[check+16:check+17]) == 1 and int(code[check+24:check+25]) == 1:
print "B"
if int(code[check+7:check+8]) == 1 and int(code[check+15:check+16]) == 1:
print "D"
if int(code[check+9:check+10]) == 1 and int(code[check+17:check+18]) == 1:
print "F" |
s745454693 | p00036 | u461370825 | 1449749359 | Python | Python | py | Runtime Error | 0 | 0 | 623 | from math import *
PI = 3.1415926535898
pool = []
pool.append("1100000011")
pool.append("1000000010000000100000001")
pool.append("1111")
pool.append("1000000110000001")
pool.append("11000000011")
pool.append("100000001100000001")
pool.append("110000011")
while True:
try:
pat = ""
for i in range(8):
pat += str(raw_input())
flag = False
tp = ""
for x in pat:
if x != '0':
flag = True
if flag:
tp += x
pat = reversed(tp)
flag = False
tp = ""
for x in pat:
if x != '0':
flag = True
if flag:
tp += x
pat = tp
print chr(pool.index(pat) + ord('A'))
except EOFError:
break |
s661303803 | p00036 | u765849500 | 1468326232 | Python | Python | py | Runtime Error | 0 | 0 | 1243 | ans = ['A','B','C','D','E','F','G']
def get(x):
for i in range(8):
for j in range(8):
if i < 7 and j < 7:
if x[i][j]=='1' and x[i+1][j]=='1' and x[i][j+1]=='1' and x[i+1][j+1]=='1':
return 0
if i<5:
if x[i][j]=='1' and x[i+1][j]=='1' and x[i+2][j]=='1' and x[i+3][j]=='1':
return 1
if j<5:
if x[i][j]=='1' and x[i][j+1]=='1' and x[i][j+2]=='1' and x[i][j+3]=='1':
return 2
if i<6 and 0<j:
if x[i][j]=='1' and x[i+1][j]=='1' and x[i+1][j-1]=='1' and x[i+2][j-1]=='1':
return 3
if i<7 and j<6:
if x[i][j]=='1' and x[i][j+1]=='1' and x[i+1][j+1]=='1' and x[i+1][j+2]=='1':
return 4
if i<6 and j<7:
if x[i][j]=='1' and x[i+1][j]=='1' and x[i+1][j+1]=='1' and x[i+2][j+1]=='1':
return 5
if i<7 and 0<j<7:
if x[i][j]=='1' and x[i][j+1]=='1' and x[i+1][j]=='1' and x[i+1][j-1]=='1':
return 6
while 1:
l = []
for i in range(8):
l.append(raw_input())
print ans[get(l)]
raw_input() |
s472555696 | p00036 | u469154576 | 1479215077 | Python | Python | py | Runtime Error | 0 | 0 | 573 | import sys
s=[]
dic={"A":["11","11"],"B":["1","1","1","1"],"C":["1111"],"D":["01","11","10"],
"E":["110","011"],"F":["10","11","01"],"G":["011","110"]}
#for line in sys.stdin:
if line!="":
s.append(line)
else:
while s[0]=="00000000":
del s[0]
while s[len(s)-1]=="00000000":
del s[len(s)-1]
i=0
while i<len(s[0]):
print i
for l in s:
if l[i]=="1"
break
else:
for l in range(len(s)):
s[l]=s[l][0:i]+s[l][i+1:len(s[l])]
i-=1
i+=1
for d in dic.keys():
if dic[d]==s:
print d
break
while len(s)>0:
del(s[0]) |
s092791803 | p00036 | u469154576 | 1479307823 | Python | Python | py | Runtime Error | 0 | 0 | 606 | import sys
s=[]
dic={"A":["11","11"],"B":["1","1","1","1"],"C":["1111"],"D":["01","11","10"],
"E":["110","011"],"F":["10","11","01"],"G":["011","110"]}
cnt=0
for line in sys.stdin:
cnt+=1
if line=="":
continue
if cnt<8:
s.append(line)
else:
cnt=0
while s[0]=="00000000":
del s[0]
while s[len(s)-1]=="00000000":
del s[len(s)-1]
i=0
while i<len(s[0]):
for l in s:
if l[i]=="1":
break
else:
for l in range(len(s)):
s[l]=s[l][0:i]+s[l][i+1:len(s[l])]
i-=1
i+=1
for d in dic.keys():
if dic[d]==s:
print d
break
while len(s)>0:
del(s[0]) |
s371467828 | p00036 | u469154576 | 1479307886 | Python | Python | py | Runtime Error | 0 | 0 | 606 | import sys
s=[]
dic={"A":["11","11"],"B":["1","1","1","1"],"C":["1111"],"D":["01","11","10"],
"E":["110","011"],"F":["10","11","01"],"G":["011","110"]}
cnt=0
for line in sys.stdin:
if line=="":
continue
cnt+=1
if cnt<8:
s.append(line)
else:
cnt=0
while s[0]=="00000000":
del s[0]
while s[len(s)-1]=="00000000":
del s[len(s)-1]
i=0
while i<len(s[0]):
for l in s:
if l[i]=="1":
break
else:
for l in range(len(s)):
s[l]=s[l][0:i]+s[l][i+1:len(s[l])]
i-=1
i+=1
for d in dic.keys():
if dic[d]==s:
print d
break
while len(s)>0:
del(s[0]) |
s877108735 | p00036 | u469154576 | 1479308526 | Python | Python | py | Runtime Error | 0 | 0 | 633 | import sys
s=[]
dic={"A":["11","11"],"B":["1","1","1","1"],"C":["1111"],"D":["01","11","10"],
"E":["110","011"],"F":["10","11","01"],"G":["011","110"]}
cnt=0
for line in sys.stdin:
if line=="\n" or line=="":
continue
cnt+=1
if cnt<8:
s.append(line.rstrip('\n'))
else:
cnt=0
while s[0]=="00000000":
del s[0]
while s[len(s)-1]=="00000000":
del s[len(s)-1]
i=0
while i<len(s[0]):
for l in s:
if l[i]=="1":
break
else:
for l in range(len(s)):
s[l]=s[l][0:i]+s[l][i+1:len(s[l])]
i-=1
i+=1
for d in dic.keys():
if dic[d]==s:
print d
break
while len(s)>0:
del(s[0]) |
s737301665 | p00036 | u469154576 | 1479309698 | Python | Python | py | Runtime Error | 0 | 0 | 633 | import sys
s=[]
dic={"A":["11","11"],"B":["1","1","1","1"],"C":["1111"],"D":["01","11","10"],
"E":["110","011"],"F":["10","11","01"],"G":["011","110"]}
cnt=0
for line in sys.stdin:
if line=="\n" or line=="":
continue
cnt+=1
if cnt<8:
s.append(line.rstrip('\n'))
else:
cnt=0
while s[0]=="00000000":
del s[0]
while s[len(s)-1]=="00000000":
del s[len(s)-1]
i=0
while i<len(s[0]):
for l in s:
if l[i]=="1":
break
else:
for l in range(len(s)):
s[l]=s[l][0:i]+s[l][i+1:len(s[l])]
i-=1
i+=1
for d in dic.keys():
if dic[d]==s:
print d
break
while len(s)>0:
del(s[0]) |
s851172652 | p00036 | u469154576 | 1479310352 | Python | Python | py | Runtime Error | 0 | 0 | 668 | import sys
dic={"A":["11","11"],"B":["1","1","1","1"],"C":["1111"],"D":["01","11","10"],
"E":["110","011"],"F":["10","11","01"],"G":["011","110"]}
s=[]
linecnt=0
for line in sys.stdin:
if line=="\n" or line=="":
continue
linecnt+=1
if linecnt<8:
s.append(line.rstrip("\n"))
else:
while s[0]=="00000000":
del(s[0])
while s[len(s)-1]=="00000000":
del(s[len(s)-1])
i=0
while i<len(s[0]):
for l in xrange(len(s)):
if s[l][i]=="1":
break
else:
for l in xrange(len(s)):
s[l]=s[l][0:i]+s[l][i+1:len(s[l])]
i-=1
i+=1
for d in dic.keys():
if dic[d]==s:
print d
break
while len(s)>0:
del(s[0])
linecnt=0 |
s616239390 | p00036 | u469154576 | 1479310720 | Python | Python | py | Runtime Error | 0 | 0 | 662 | import sys
dic={"A":["11","11"],"B":["1","1","1","1"],"C":["1111"],"D":["01","11","10"],
"E":["110","011"],"F":["10","11","01"],"G":["011","110"]}
s=[]
linecnt=0
for line in sys.stdin:
if line=="\n" or line=="":
continue
linecnt+=1
if linecnt<8:
s.append(line.rstrip("\n"))
else:
while s[0]=="00000000":
del(s[0])
while s[len(s)-1]=="00000000":
del(s[len(s)-1])
i=len(s[0])-1
while i>=0:
for l in xrange(len(s)):
if s[l][i]=="1":
break
else:
for l in xrange(len(s)):
s[l]=s[l][0:i]+s[l][i+1:len(s[l])]
i-=1
for d in dic.keys():
if dic[d]==s:
print d
break
while len(s)>0:
del(s[0])
linecnt=0 |
s265458765 | p00036 | u301729341 | 1481256299 | Python | Python3 | py | Runtime Error | 0 | 0 | 1198 | while True:
try:
Map = []
Base = []
End = []
for i in range(8):
Map.append(list(map(str,input())))
for i in range(8):
if Base == []:
for j in range(8):
if Map[i][j] == '1':
Base = [j,i]
break
else:
break
for i in range(7,-1,-1):
if End == []:
for j in range(7,-1,-1):
if Map[i][j] == '1':
End = [j,i]
break
else:
break
Yoko = End[0] - Base[0]
Tate = End[1] - Base[1]
if Tate == 1 and Yoko == 1:
print("A")
elif Yoko == 0 and Tate == 3:
print("B")
elif Tate == 0 and Yoko == 3:
print("C")
elif Yoko == -1 and Tate == 2:
print("D")
elif Yoko == 2 and Tate == 1:
print("E")
elif Yoko == 1 and Tate == 2:
print("F")
elif Tate == 1 and Yoko == 0:
print("G")
except EOFError:
break |
s611332189 | p00036 | u546285759 | 1483258645 | Python | Python3 | py | Runtime Error | 0 | 0 | 707 | import sys
for s in sys.stdin:
a_b = True
for i in range(8):
for j in range(8):
ss = s.splitlines()[i][j]
if int(ss) == 1 and a_b:
a_b, a_v = False, (i, j)
if int(ss) == 1 and not a_b:
z_v = (i, j)
if a_v[0]+1==z_v[0] and a_v[1]+1==z_v[1]:
print("A")
elif a_v[0]+3==z_v[0] and a_v[1]==z_v[1]:
print("B")
elif a_v[0]==z_v[0] and a_v[1]+3==z_v[1]:
print("C")
elif a_v[0]+2==z_v[0] and a_v[1]-1==z_v[1]:
print("D")
elif a_v[0]+1==z_v[0] and a_v[1]+2==z_v[1]:
print("E")
elif a_v[0]+2==z_v[0] and a_v[1]+1==z_v[1]:
print("F")
else:
print("G") |
s044036418 | p00036 | u546285759 | 1483259331 | Python | Python3 | py | Runtime Error | 0 | 0 | 774 | s = []
while True:
try:
s = [input()+"\n" for _ in range(8)]
except:
break
a_b = True
for i in range(8):
for j in range(8):
ss = s.splitlines()[i][j]
if int(ss) == 1 and a_b:
a_b, a_v = False, (i, j)
if int(ss) == 1 and not a_b:
z_v = (i, j)
if a_v[0]+1==z_v[0] and a_v[1]+1==z_v[1]:
print("A")
elif a_v[0]+3==z_v[0] and a_v[1]==z_v[1]:
print("B")
elif a_v[0]==z_v[0] and a_v[1]+3==z_v[1]:
print("C")
elif a_v[0]+2==z_v[0] and a_v[1]-1==z_v[1]:
print("D")
elif a_v[0]+1==z_v[0] and a_v[1]+2==z_v[1]:
print("E")
elif a_v[0]+2==z_v[0] and a_v[1]+1==z_v[1]:
print("F")
else:
print("G") |
s617364325 | p00036 | u546285759 | 1483259455 | Python | Python3 | py | Runtime Error | 0 | 0 | 756 | s = []
while True:
try:
s = [input() for _ in range(8)]
except:
break
a_b = True
for i in range(8):
for j in range(8):
ss = s[i][j]
if int(ss) == 1 and a_b:
a_b, a_v = False, (i, j)
if int(ss) == 1 and not a_b:
z_v = (i, j)
if a_v[0]+1==z_v[0] and a_v[1]+1==z_v[1]:
print("A")
elif a_v[0]+3==z_v[0] and a_v[1]==z_v[1]:
print("B")
elif a_v[0]==z_v[0] and a_v[1]+3==z_v[1]:
print("C")
elif a_v[0]+2==z_v[0] and a_v[1]-1==z_v[1]:
print("D")
elif a_v[0]+1==z_v[0] and a_v[1]+2==z_v[1]:
print("E")
elif a_v[0]+2==z_v[0] and a_v[1]+1==z_v[1]:
print("F")
else:
print("G") |
s186005929 | p00036 | u873482706 | 1483274677 | Python | Python3 | py | Runtime Error | 0 | 0 | 1020 | # -*- coding: utf-8 -*-
figures = {
'A': [['1', '1'], ['1', '1']],
'B': [['1'], ['1'], ['1'], ['1']],
'C': [['1', '1', '1', '1']],
'D': [['0', '1'], ['1', '1'], ['1', '0']],
'E': [['1', '1', '0'], ['0', '1', '1']],
'F': [['1', '0'], ['1', '1'], ['0', '1']],
'G': [['0', '1', '1'], ['1', '1', '0']],
}
def f1(lines):
for n, figure in figures.items():
found = f2(lines, figure)
if found:
print(n)
break
def f2(lines, figure):
height = len(figure)
width = len(figure[0])
for h in range(8 - height + 1):
for w in range(8 - width + 1):
found = f3(lines, figure, height, width, h, w)
if found:
return True
def f3(lines, figure, height, width, h, w):
_figure = [[lines[h+_h][w+_w] for _w in range(width)]
for _h in range(height)]
if figure == _figure:
return True
try:
while True:
f1([list(input()) for _ in range(8)])
except EOFError:
pass |
s996794433 | p00036 | u711765449 | 1484918300 | Python | Python3 | py | Runtime Error | 0 | 0 | 1083 | def get_data():
array = []
for i in range(8):
array.append(input())
return array
def judge():
array = get_data()
count = [[0 for i in range(8)] for i in range(8)]
for i in range(8):
x = 0
for j in array[i]:
if int(j) == 1:
count[i][x] += 1
x += 1
a = 0
p = []
for i in range(8):
for j in range(8):
if count[i][j] != 0:
p.append(a)
a += 1
if p[0]+1 != p[1]:
if p[0] + 8*3 == p[3]:
print('B')
else:
if p[0] + 8*2 + 1 == p[3]:
print('F')
else:
print('D')
else:
if p[0]+1 == p[1] and p[1]+1 == p[2]:
print('C')
else:
if p[0] + 8 == p[2] and p[1] + 8 == p[3]:
print('A')
else:
if p[0]+8*2 == p[2]:
print('G')
else:
print('E')
while True:
try:
judge()
except EOFError:
break |
s975335460 | p00036 | u711765449 | 1484918408 | Python | Python3 | py | Runtime Error | 0 | 0 | 1119 | # -*- coding:utf-8 -*-
def get_data():
array = []
for i in range(8):
array.append(input())
return array
def judge():
array = get_data()
count = [[0 for i in range(8)] for i in range(8)]
for i in range(8):
x = 0
for j in array[i]:
if int(j) == 1:
count[i][x] += 1
x += 1
a = 0
p = []
for i in range(8):
for j in range(8):
if count[i][j] != 0:
p.append(a)
a += 1
if p[0]+1 != p[1]:
if p[0] + 8*3 == p[3]:
print('B')
else:
if p[0] + 8*2 + 1 == p[3]:
print('F')
else:
print('D')
else:
if p[0]+1 == p[1] and p[1]+1 == p[2]:
print('C')
else:
if p[0] + 8 == p[2] and p[1] + 8 == p[3]:
print('A')
else:
if p[0]+8*2 == p[2]:
print('G')
else:
print('E')
while True:
try:
judge()
except EOFError:
break |
s272787548 | p00036 | u546285759 | 1493276326 | Python | Python3 | py | Runtime Error | 0 | 0 | 537 | flag = False
while True:
try:
string = [input() for _ in range(8)]
except:
break
if flag:
print()
string = [int(l) for line in string for l in line] + [0]*16
one = string.index(1)
s = string[one:]
ones = [[1, 8, 9], [8, 16, 24], [1, 2, 3],
[7, 8, 15], [1, 9, 10], [8, 9, 17], [1, 7, 8]]
ans = {0: "A", 1: "B", 2: "C", 3: "D", 4: "E", 5: "F", 6: "G"}
for k, o in enumerate(ones):
if all([s[o[0]], s[o[1]], s[o[2]]]):
print(ans[k])
flag = True |
s705149817 | p00036 | u546285759 | 1493276472 | Python | Python3 | py | Runtime Error | 0 | 0 | 491 | while True:
string = [input() for _ in range(8)]
string = [int(l) for line in string for l in line] + [0]*16
one = string.index(1)
s = string[one:]
ones = [[1, 8, 9], [8, 16, 24], [1, 2, 3],
[7, 8, 15], [1, 9, 10], [8, 9, 17], [1, 7, 8]]
ans = {0: "A", 1: "B", 2: "C", 3: "D", 4: "E", 5: "F", 6: "G"}
for k, o in enumerate(ones):
if all([s[o[0]], s[o[1]], s[o[2]]]):
print(ans[k])
try:
input()
except:
break |
s121465177 | p00036 | u546285759 | 1493276641 | Python | Python3 | py | Runtime Error | 0 | 0 | 539 | while True:
try:
string = [input() for _ in range(8)]
string = [int(l) for line in string for l in line] + [0]*16
one = string.index(1)
s = string[one:]
ones = [[1, 8, 9], [8, 16, 24], [1, 2, 3],
[7, 8, 15], [1, 9, 10], [8, 9, 17], [1, 7, 8]]
ans = {0: "A", 1: "B", 2: "C", 3: "D", 4: "E", 5: "F", 6: "G"}
for k, o in enumerate(ones):
if all([s[o[0]], s[o[1]], s[o[2]]]):
print(ans[k])
input()
except:
break |
s865375409 | p00036 | u299798926 | 1518508582 | Python | Python3 | py | Runtime Error | 0 | 0 | 751 | while True:
try:
x=[[int(i) for i in input()] for j in range(8)]
count=0
num=[]
for i in range(8):
if x[i].count(1)!=0:
num.append(i)
count+=1
if count==1:
print("C")
elif count==4:
print("B")
elif count==2:
for j in range(8):
if x[num[0]][j]==1:
if j==0:
if x[num[0]+1][j]==1:
print("A")
else:
print("E")
else:
if x[num[0]+1][j-1]==1:
print("G")
else:
if x[num[0]+1][j]==1:
print("A")
else:
print("E")
break
else:
for j in range(8):
if x[num[0]][j]==1:
if j==0:
print("F")
else:
if x[num[0]][j-1]==1:
print("D")
else:
print("F")
break
except EOFError:
break
|
s123918054 | p00036 | u236679854 | 1520546392 | Python | Python3 | py | Runtime Error | 0 | 0 | 426 | shapes = {
'A': '1100000011',
'B': '1000000010000000100000001',
'C': '1111',
'D': '01000000110000001',
'E': '11000000011',
'F': '100000001100000001',
'G': '0110000011'
}
while True:
plane = ''
for i in range(8):
plane += input()
for name in shapes:
try:
plane.index(shapes[name])
print(name)
break
except:
pass
|
s353974451 | p00036 | u236679854 | 1520546403 | Python | Python3 | py | Runtime Error | 0 | 0 | 426 | shapes = {
'A': '1100000011',
'B': '1000000010000000100000001',
'C': '1111',
'D': '01000000110000001',
'E': '11000000011',
'F': '100000001100000001',
'G': '0110000011'
}
while True:
plane = ''
for i in range(8):
plane += input()
for name in shapes:
try:
plane.index(shapes[name])
print(name)
break
except:
pass
|
s975363939 | p00036 | u744114948 | 1521172547 | Python | Python3 | py | Runtime Error | 0 | 0 | 506 | while True:
try:
l = []
for i in range(8):
l += list(map(int, input()))
except:
break
cnt = 0
for i in range(len(l)):
if l[i]:
cnt += i
cnt -= l.index(1) * 4
if cnt == 18:
ans = "A"
elif cnt == 48:
ans = "B"
elif cnt == 6:
ans = "C"
elif cnt == 34:
ans = "D"
elif cnt == 20:
ans = "E"
elif cnt == 34:
ans = "F"
else:
ans = "G"
print(ans)
|
s577911917 | p00036 | u066293792 | 1524712596 | Python | Python3 | py | Runtime Error | 0 | 0 | 159 | # coding: utf-8
# Your code here!
input_lines = int(input())
for i in range(input_lines):
s = input().rstrip().split("\n")
for i range 8:
print (s)
|
s572827026 | p00036 | u066293792 | 1524712723 | Python | Python3 | py | Runtime Error | 0 | 0 | 160 | # coding: utf-8
# Your code here!
input_lines = int(input())
for i in range(input_lines):
s = input().rstrip().split("\n")
#for i range 8:
print (s)
|
s658153139 | p00036 | u136916346 | 1527520561 | Python | Python3 | py | Runtime Error | 0 | 0 | 429 | import sys
l=[t for t in sys.stdin]
i=0
while 1:
pt=[i.find("1") for i in l[9*i:9*(i+1)] if i.find("1")!=-1]
if not pt:break
if len(pt)==1:print("C")
elif len(pt)==2 and pt[0]==pt[1]:print("A")
elif len(pt)==2 and pt[0]<pt[1]:print("E")
elif len(pt)==2 and pr[0]>pt[1]:print("G")
elif len(pt)==3 and pt[0]>pt[1]:print("D")
elif len(pt)==3 and pt[0]<pt[1]:print("F")
else: print("B")
i+=1
|
s450303936 | p00036 | u136916346 | 1527520644 | Python | Python3 | py | Runtime Error | 0 | 0 | 429 | import sys
l=[t for t in sys.stdin]
i=0
while 1:
pt=[i.find("1") for i in l[9*i:9*(i+1)] if i.find("1")!=-1]
if not pt:break
if len(pt)==1:print("C")
elif len(pt)==2 and pt[0]==pt[1]:print("A")
elif len(pt)==2 and pt[0]<pt[1]:print("E")
elif len(pt)==2 and pr[0]>pt[1]:print("G")
elif len(pt)==3 and pt[0]>pt[1]:print("D")
elif len(pt)==3 and pt[0]<pt[1]:print("F")
else: print("B")
i+=1
|
s445137036 | p00036 | u136916346 | 1527520914 | Python | Python3 | py | Runtime Error | 0 | 0 | 410 | import sys
l=[t for t in sys.stdin]
i=0
while 1:
pt=[i.find("1") for i in l[9*i:9*(i+1)] if i.find("1")!=-1]
if not pt:break
if len(pt)==1:print("C")
elif len(pt)==2
if pt[0]==pt[1]:print("A")
elif pt[0]<pt[1]:print("E")
elif pr[0]>pt[1]:print("G")
elif len(pt)==3
if pt[0]>pt[1]:print("D")
elif pt[0]<pt[1]:print("F")
else: print("B")
i+=1
|
s065353572 | p00036 | u136916346 | 1527520990 | Python | Python3 | py | Runtime Error | 0 | 0 | 412 | import sys
l=[t for t in sys.stdin]
i=0
while 1:
pt=[i.find("1") for i in l[9*i:9*(i+1)] if i.find("1")!=-1]
if not pt:break
if len(pt)==1:print("C")
elif len(pt)==2:
if pt[0]==pt[1]:print("A")
elif pt[0]<pt[1]:print("E")
elif pr[0]>pt[1]:print("G")
elif len(pt)==3:
if pt[0]>pt[1]:print("D")
elif pt[0]<pt[1]:print("F")
else: print("B")
i+=1
|
s679257700 | p00036 | u459861655 | 1353000459 | Python | Python | py | Runtime Error | 0 | 5016 | 328 | ans = {18:'A',48:'B',3:'C',30:'D',20:'E',34:'F',16:'G'}
while True:
s = 0
d = -1
for i in range(8):
try:
line = raw_input()
except EOFError:
break
for (j, c) in enumerate(list(line)):
if c == '1':
if d < 0:
d = 8*i + j
s += 8 * i + j - d
raw_input()
print ans[s] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.