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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s496707036 | p03645 | u623819879 | 1554511567 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2107 | 62296 | 327 | # coding: utf-8
# Your code here!
n,m=map(int,input().split())
a=[0]*(n+1)
b=[0]*(n+1)
f1=[]
f2=[]
for i in range(m):
a[i],b[i]=map(int,input().split())
if a[i]==1:
f1.append(b[i])
if b[i]==n:
f2.append(i)
ans='IMPOSSIBLE'
for i in f2:
if a[i] in f1:
ans='POSSIBLE'
prin... |
s457355929 | p03645 | u623819879 | 1554510832 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2108 | 55128 | 274 |
n,m=map(int,input().split())
a=[0]*(n+1)
b=[0]*(n+1)
pos=[]
for i in range(m):
a[i],b[i]=map(int,input().split())
if a[i]==1:
pos.append(b[i])
ans='IMPOSSIBLE'
for i in range(m):
if b[i]==n:
if a[i] in pos:
ans='POSSIBLE'
print(ans) |
s719325568 | p03645 | u798129018 | 1554324682 | Python | Python (3.4.3) | py | Runtime Error | 671 | 51740 | 352 |
N,M = map(int,input().split())
ab =[list(map(int,input().split())) for i in range(M)]
dist = [INF]*(N)
for i in range(M):
if ab[i][0] == 1:
dist[ab[i][1]-1] = 1
for i in range(M):
if ab[i][1] == N:
if dist[ab[i][0]-1] <= 1:
print("POSSIBLE")
exit()
else:
... |
s909393903 | p03645 | u619458041 | 1554255222 | Python | Python (3.4.3) | py | Runtime Error | 397 | 39548 | 476 | import sys
from collections import deque
def main():
input = sys.stdin.readline
N, M = map(int, input().split())
A = [[] for _ in range(N+1)]
for _ in range(M):
a, b = map(int, input().split())
A[a].append(b)
A[b].append(a)
q = deque()
q.append(*A[1])
while len(q) ... |
s033265088 | p03645 | u151625340 | 1553748798 | Python | PyPy3 (2.4.0) | py | Runtime Error | 948 | 59608 | 726 | N,M = map(int,input().split())
one = []
nnn = []
for i in range(M):
ai,bi = map(int,input().split())
if ai == 1:
one.append(bi)
if bi == N:
nnn.append(ai)
def bs_left(l, target): # l=sorted, target以上の値をもつ要素のうち一番左のindexを返す
low, high = 0, len(l)
while low < high:
mid = (low+hig... |
s260946481 | p03645 | u161442663 | 1553714042 | Python | Python (3.4.3) | py | Runtime Error | 591 | 18940 | 478 | N,M=map(int,input().split())
g=0
ListA=[]
ListB=[]
for i in range(0,M,1):
a,b=map(int,input().split())
ListA.append(a)
ListB.append(b)
ListC=[]
c=ListA.count(1)
for i in range(0,c,1): #ListCに1からの行き先を入れる
d=ListA.find(1)
ListA.pop(d)
ListA.insert(d,0)
ListC.append(d)
for i in range(0,len(ListC),1):
e=Li... |
s195853920 | p03645 | u161442663 | 1553713996 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 476 | N,M=map(int,input().split())
g=0
ListA=[]
ListB=[]
for i in range(0,M,1):
a,b=map(int,input().split())
ListA.append(a)
ListB.append(b)
ListC=[]
c=ListA.count(1)
for i in range(0,c,1): #ListCに1からの行き先を入れる
d=ListA.find(1)
ListA.pop(d)
ListA.insert(d,0)
ListC.append(d)
for i in range(0,len(ListC),1):
e=Li... |
s083086701 | p03645 | u282228874 | 1553357241 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 265 | n,m = map(int,input().split())
s = [0]*n
g = [0]*n
for i in range(m):
a,b = map(int,input().split())
if a == 1:
s[b] = 1
if b == n:
g[a] = 1
for i in range(n):
if s[i] and g[i]:
print("POSSIBLE")
exit()
print("IMPOSSIBLE") |
s801576920 | p03645 | u305965165 | 1552949555 | Python | Python (3.4.3) | py | Runtime Error | 500 | 48288 | 371 | import numpy as np
import sys
input = sys.stdin.readline
n,m = (int(i) for i in input().split())
ab = [[int(i)-1 for i in input().split()] for i in range(m)]
mat = np.zeros((n,n))
for x in ab:
mat[x[0]][x[1]] = 1
mat[x[1]][x[0]] = 1
vec = np.zeros(n)
vec[0] = 1
vec[-1] = 1
if list(mat.dot(vec)).count(2) > 0:
... |
s481570789 | p03645 | u887207211 | 1552629751 | Python | Python (3.4.3) | py | Runtime Error | 337 | 4596 | 213 | N, M = map(int,input().split())
e = [0]*N
for _ in range(M):
a, b = map(int,input().split())
if(a == 1):
e[a] += 1
elif(b == N):
e[b] += 1
if(2 in e):
print("POSSIBLE")
else:
print("IMPOSSIBLE") |
s451578512 | p03645 | u585482323 | 1552432252 | Python | PyPy3 (2.4.0) | py | Runtime Error | 202 | 52336 | 1262 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.... |
s374755234 | p03645 | u585482323 | 1552432217 | Python | PyPy3 (2.4.0) | py | Runtime Error | 207 | 52592 | 1238 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.... |
s360553421 | p03645 | u634461820 | 1552430930 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 453 | input = sys.stdin.readline
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()
N,M = IL()
data = []
for i in range(M):
a,b = IL()
if a == 1:
if b in data:
print("POSSIBLE")
break
else:
data.app... |
s120805774 | p03645 | u634461820 | 1552424877 | Python | Python (3.4.3) | py | Runtime Error | 1065 | 52620 | 332 | N,M = list(map(int,input().split()))
ab = [list(map(int,input().split())) for i in range(M)]
ab.sort()
data = []
for a,b in ab:
if a == 1:
data.append(b)
else:
break
for i in range(M,-1,-1):
a = ab[i][0]
if a in data and ab[i][1] == N:
print("POSSIBLE")
break
elif a==1:
print("IMPOSSIBLE... |
s641031617 | p03645 | u174394352 | 1550717896 | Python | PyPy3 (2.4.0) | py | Runtime Error | 185 | 38640 | 254 | H,W=map(int,input().split())
N=int(input())
a=list(map(int,input().split()))
ans=''
for i in range(N):
ans+=str(i+1)*a[i]
for j in range(H):
s=ans[W*j:W*(j+1)]
if j%2==0:
print(' '.join(s))
else:
print(' '.join(s[::-1])) |
s500479494 | p03645 | u025235255 | 1550656197 | Python | PyPy3 (2.4.0) | py | Runtime Error | 164 | 38256 | 277 | n, m = map(int,input().split())
s = [list(map(int,input().split())) for i in range(m)]
nl = [[] for i in range(n+1)]
for a,b in s: nl[a].append(b
can = False
for i in range(2,n):
if i in nl[1] and n in nl[i]: can = True
ans = "POSSIBLE" if can else "IMPOSSIBLE"
print(ans) |
s735145767 | p03645 | u371763408 | 1550152497 | Python | Python (3.4.3) | py | Runtime Error | 879 | 39984 | 504 | n,m=map(int,input().split())
edges=[[]for i in range(n)]
visited=[False]*n
cnt=0
def dfs(u,cnt,visited):
visited=visited[:]
cnt=cnt
visited[u]=True
if visited[-1]==True:
return cnt,visited
cnt+=1
for v in edges[u]:
if visited[v]==False:
dfs(v,cnt,visited)
return cnt,visited
for i in range(m... |
s166859035 | p03645 | u371763408 | 1550152321 | Python | Python (3.4.3) | py | Runtime Error | 947 | 40836 | 479 | n,m=map(int,input().split())
edges=[[]for i in range(n)]
visited=[False]*n
cnt=0
def dfs(u):
global visited
global cnt
visited[u]=True
if visited[-1]==True:
return cnt,visited
cnt+=1
for v in edges[u]:
if visited[v]==False:
dfs(v)
return cnt,visited
for i in range(m):
a,b=map(int,input().... |
s172224848 | p03645 | u371763408 | 1550152187 | Python | Python (3.4.3) | py | Runtime Error | 997 | 40836 | 475 | n,m=map(int,input().split())
edges=[[]for i in range(n)]
visited=[False]*n
cnt=0
def dfs(u):
global visited
global cnt
visited[u]=True
if visited[-1]==True:
return cnt,visited
cnt+=1
for v in edges[u]:
if visited[v]==False:
dfs(v)
return visited,cnt
for i in range(m):
a,b=map(int,input().... |
s286386054 | p03645 | u219607170 | 1548800706 | Python | Python (3.4.3) | py | Runtime Error | 737 | 30712 | 269 | N, M = map(int, input().split())
d = {}
for _ in range(M):
a, b = map(int, input().split())
if a not in d:
d[a] = [b]
else:
d[a].append(b)
for i in d[1]:
if N in d[i]:
print('POSSIBLE')
break
else:
print('IMPOSSIBLE') |
s837651038 | p03645 | u977389981 | 1548636904 | Python | Python (3.4.3) | py | Runtime Error | 810 | 39336 | 418 | import bisect
n, m = map(int, input().split())
AB = [[int(i) for i in input().split()] for i in range(m)]
S = []
G = []
for ab in AB:
if ab[0] == 1:
S.append(ab[1])
if ab[1] == n:
G.append(ab[0])
S.sort()
G.sort()
ans = 'IMPOSSIBLE'
if len(S) != 0 and len(G) != 0:
for s in S:
... |
s120854995 | p03645 | u977389981 | 1548636800 | Python | Python (3.4.3) | py | Runtime Error | 793 | 39336 | 402 | import bisect
n, m = map(int, input().split())
AB = [[int(i) for i in input().split()] for i in range(m)]
S = []
G = []
for ab in AB:
if ab[0] == 1:
S.append(ab[1])
if ab[1] == n:
G.append(ab[0])
S.sort()
G.sort()
ans = 'IMPOSSIBLE'
if len(G) != 0:
for s in S:
idx = bisect... |
s480348241 | p03645 | u977389981 | 1548630947 | Python | Python (3.4.3) | py | Runtime Error | 628 | 39340 | 383 | import bisect
n, m = map(int, input().split())
AB = [[int(i) for i in input().split()] for i in range(m)]
S = []
G = []
for ab in AB:
if ab[0] == 1:
S.append(ab[1])
if ab[1] == n:
G.append(ab[0])
ans = 'IMPOSSIBLE'
if len(G) != 0:
for s in S:
idx = bisect.bisect_left(G, s)
... |
s485249014 | p03645 | u099566485 | 1548474176 | Python | Python (3.4.3) | py | Runtime Error | 160 | 14968 | 298 | import numpy as np
n,m=map(int,input().split())
nextmatrix=np.zeros((n,n))
for i in range(m):
a,b=map(int,input().split())
nextmatrix[a-1][b-1]=1
nextmatrix[b-1][a-1]=1
nextmatrix2=nextmatrix.dot(nextmatrix)
if nextmatrix2[0][n-1]==0:
print("IMPOSSIBLE")
else:
print("POSSIBLE") |
s547921127 | p03645 | u099566485 | 1548473606 | Python | Python (3.4.3) | py | Runtime Error | 153 | 14412 | 341 | #068-C
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()
import numpy as np
n,m=IL()
nm=np.zeros((n,n))
for i in range(m):
a,b=IL()
nm[a-1][b-1]=1
nm[b-1][a-1]=1
nm=nm.dot(nm)
if nm[0][n-1]==0:
print("IMPOSSIBLE")
else:
... |
s060768501 | p03645 | u785989355 | 1544172810 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 607 |
N,M = list(map(int,input().split()))
path = [[False,False] for i in range(N)]
flag=False
for i in range(M):
a,b = list(map(int,input().split()))
if a=N-1:
if path[b-1][0]:
flag=True
path[b-1][1]=True
if a=0:
if path[b-1][1]:
flag=True
... |
s591482411 | p03645 | u785989355 | 1544172757 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 627 |
N,M = list(map(int,input().split()))
path = [[False,False] for i in range(N)]
flag=False
for i in range(M):
a,b = list(map(int,input().split()))
if a=N-1:
if path[b-1][0]:
flag=True
break
path[b-1][1]=True
if a=0:
if path[b-1][1]:
flag=True
... |
s970830336 | p03645 | u652150585 | 1542273686 | Python | Python (3.4.3) | py | Runtime Error | 1162 | 51740 | 564 | n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
#print(n,m,l)
def bin_search(a,li):
max_len=len(li)
min_len=0
while max_len>=min_len:
mid=(max_len+min_len)//2
if li[mid]==a:
return True
elif li[mid]<a:
min_len=mid+1
el... |
s082626313 | p03645 | u652150585 | 1542272692 | Python | Python (3.4.3) | py | Runtime Error | 738 | 51744 | 651 | n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
#print(n,m,l)
def bin_search(a,li):
max_len=len(li)
min_len=0
while max_len>min_len:
mid=(max_len+min_len)//2
if li[mid]==a:
return True
elif abs(min_len-max_len)==1 and li[min_len]!=a and l... |
s695283423 | p03645 | u652150585 | 1542272576 | Python | Python (3.4.3) | py | Runtime Error | 691 | 51744 | 662 | n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
#print(n,m,l)
def bin_search(a,li):
max_len=len(li)
min_len=0
while max_len>min_len:
mid=(max_len+min_len)//2
if li[mid]==a:
return True
elif abs(min_len-max_len)==1 and li[mid]!=a and li[mi... |
s396898028 | p03645 | u845427284 | 1542155470 | Python | Python (3.4.3) | py | Runtime Error | 657 | 51740 | 404 | n, m = map(int, input().split())
hune= [list(map(int, input().split())) for i in range(m)]
hune1 = []
hune2 = []
for keiro in hunes:
keiro.sort()
if keiro[0] == 1:
hune1.append(keiro)
if keiro[1] == n:
hune2.append(keiro)
possible = []
for i in hune1:
for j in hune2:
if i[1] == j[0]:
print("... |
s819673054 | p03645 | u426108351 | 1541621591 | Python | Python (3.4.3) | py | Runtime Error | 1919 | 63148 | 541 | import bisect
N, M = map(int, input().split())
a = []
number = []
flag = 0
for i in range(M):
A, B = map(int, input().split())
a.append([A, B])
a.append([B, A])
number.append(A)
number.append(B)
a.sort()
b = a[:]
b.reverse()
one = []
two = []
for i in range(M):
if a[i][0] == 1:
one.appen... |
s965616915 | p03645 | u426108351 | 1541620976 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 682 | import bisect
N, M = map(int, input().split())
a = []
number = []
flag = 0
for i in range(M):
A, B = map(int, input().split())
a.append([A, B])
a.append([B, A])
number.append(A)
number.append(B)
a.sort()
b = a[:]
b.reverse()
one = []
two = []
for i in range(M):
if a[i][0] == 1:
one.appen... |
s021980869 | p03645 | u426108351 | 1541620834 | Python | PyPy3 (2.4.0) | py | Runtime Error | 195 | 38384 | 684 | import bisect
N, M = map(int, input().split())
a = []
number = []
flag = 0
for i in range(M):
A, B = map(int, input().split())
a.append([A, B])
a.append([B, A])
number.append(A)
number.append(B)
a.sort()
b = a[:]
b.reverse()
one = []
two = []
for i in range(M):
if a[i][0] == 1:
one.appen... |
s687060266 | p03645 | u006657459 | 1541297856 | Python | PyPy3 (2.4.0) | py | Runtime Error | 162 | 38384 | 407 | from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra
N, M = map(int, input().split())
a, b, d = [0]*M, [0]*M, [0]*M
for i in range(M):
a[i], b[i] = map(int, input().split())
a[i], b[i] = a[i] - 1, b[i] - 1
G = csr_matrix(([1]*M, (a, b)), shape=(N, N))
D = dijkstra(G, directed=False, i... |
s799412729 | p03645 | u317892501 | 1540227437 | Python | Python (3.4.3) | py | Runtime Error | 736 | 11456 | 519 | import bisect
n, m = map(int, input().split())
f_1 = []
t_n = []
jedge = 0
for i in range(m):
a, b = map(int, input().split())
if a == 1:
f_1.append(b)
if b == n:
t_n.append(a)
f_1.sort()
t_n.sort()
for i in range(len(f_1)):
p = bisect.bisect_left(t_n, f_1[i])
if p != len(t_n)-1 and... |
s041104007 | p03645 | u317892501 | 1540227365 | Python | Python (3.4.3) | py | Runtime Error | 741 | 11448 | 515 | import bisect
n, m = map(int, input().split())
f_1 = []
t_n = []
jedge = 0
for i in range(m):
a, b = map(int, input().split())
if a == 1:
f_1.append(b)
if b == n:
t_n.append(a)
f_1.sort()
t_n.sort()
for i in range(len(f_1)):
p = bisect.bisect_left(t_n, f_1[i])
if p != len(t_n) and f... |
s021676690 | p03645 | u317892501 | 1540227209 | Python | Python (3.4.3) | py | Runtime Error | 699 | 11428 | 418 | import bisect
n, m = map(int, input().split())
f_1 = []
t_n = []
jedge = 0
for i in range(m):
a, b = map(int, input().split())
if a == 1:
f_1.append(b)
if b == n:
t_n.append(a)
f_1.sort()
t_n.sort()
for i in range(len(f_1)):
p = bisect.bisect_left(t_n, f_1[i])
if f_1[i] == t_n[p]:
... |
s013449305 | p03645 | u317892501 | 1540226865 | Python | Python (3.4.3) | py | Runtime Error | 713 | 11456 | 420 | import bisect
n, m = map(int, input().split())
f_1 = []
t_n = []
jedge = 0
for i in range(m):
a, b = map(int, input().split())
if a == 1:
f_1.append(b)
if b == n:
t_n.append(a)
f_1.sort()
t_n.sort()
for i in range(len(f_1)):
p = bisect.bisect_left(t_n, f_1[i])
if f_1[i] == t_n[p+1]:... |
s090669496 | p03645 | u940102677 | 1539866998 | Python | Python (3.4.3) | py | Runtime Error | 739 | 12596 | 330 | p=[]
q=[]
n,m = map(int,input().split())
for _ in [0]*m:
a,b = map(int,input().split())
if a == 1:
p += [b]
elif b == n:
q += [a]
p.sort()
q.sort()
i,j = 0,0
while i<len(p) or j<len(q):
if p[i]<q[j]:
i += 1
elif p[i]>q[j]:
j += 1
else:
print("POSSIBLE")
exit()
print("IM... |
s537959626 | p03645 | u940102677 | 1539866950 | Python | Python (3.4.3) | py | Runtime Error | 714 | 12612 | 320 | p=[]
q=[]
n,m = map(int,input().split())
for _ in [0]*m:
a,b = map(int,input().split())
if a == 1:
p += [b]
elif b == n:
q += [a]
p.sort()
q.sort()
i,j = 0,0
while i<m or j<m:
if p[i]<q[j]:
i += 1
elif p[i]>q[j]:
j += 1
else:
print("POSSIBLE")
exit()
print("IMPOSSIBLE") |
s553593384 | p03645 | u940102677 | 1539866798 | Python | Python (3.4.3) | py | Runtime Error | 721 | 12536 | 320 | p=[]
q=[]
n,m = map(int,input().split())
for _ in [0]*m:
a,b = map(int,input().split())
if a == 1:
p += [b]
elif b == n:
q += [a]
p.sort()
q.sort()
i,j = 0,0
while i<n or j<n:
if p[i]<q[j]:
i += 1
elif p[i]>q[j]:
j += 1
else:
print("POSSIBLE")
exit()
print("IMPOSSIBLE") |
s439941272 | p03645 | u940102677 | 1539865949 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 223 | p=[]
q=[]
n,m = map(int,input().spplit())
for _ in [0]*m:
a,b = map(int,input().spplit())
if a == 1:
p += [b]
elif b == n:
q += [a]
for x in p:
if x in q:
print("POSSIBLE")
exit()
print("IMPOSSIBLE") |
s153039563 | p03645 | u513081876 | 1537851601 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 291 | N, M = map(int, input().split())
mid, las = [], []
ans = 0
for i in range(M):
a, b = map(int, input().split())
if a == 1:
mid.append(b)
elif b == N:
las.append(a)
if set(mid) & set(las) != 0:
ans = 1
print('POSSIBLE' if ans == 1 else 'INPOSSIBLE') |
s986143986 | p03645 | u513081876 | 1537848730 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 348 | N, M = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(MM)]
ans = 0
tyukan = []
saigo = []
for i in range(M):
if ab[i][0] == 1:
tyukan.append(ab[i][1])
for i in ab:
if ab[i][0] in tyukan:
if ab[i][1] == N:
ans =1
break
print('POSSIBLE' if... |
s797828424 | p03645 | u427344224 | 1536206206 | Python | Python (3.4.3) | py | Runtime Error | 801 | 58936 | 461 | N, M = map(int, input().split())
line = []
for i in range(M):
ab = list(map(int, input().split()))
line.append(ab)
start = 1
end = N
first = set()
second = set()
for l in line:
if end in l:
second.add(l[0])
second.add(l[1])
elif start in l:
first.add(l[1])
first.add(l[... |
s462254555 | p03645 | u663101675 | 1534964862 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 302 | N, M = list(map(int, input().split()))
X = [0] * N
Y = [0] * N
for i in range(M):
S, E = list(map(int, input().split()))
if S == 1:
X[E-1] = 1
if E == N:
Y[S-1] = 1
for i in range(N):
if X[i] = Y[i]:
print("POSSIBLE")
break
else:
print("IMPOSSIBLE")
|
s970870694 | p03645 | u746220087 | 1534120445 | Python | Python (2.7.6) | py | Runtime Error | 589 | 60336 | 574 | s1 = raw_input().split(' ')
n, m = int(s1[0]), int(s1[1])
i2il = {}
for _ in range(m):
s = raw_input().split(' ')
if s[0] in i2il:
i2il[s[0]].append(s[1])
else:
i2il[s[0]] = [s[1]]
if s[1] in i2il:
i2il[s[1]].append(s[0])
else:
i2il[s[1]] = [s[0]]
if '1' not in i2il o... |
s112068111 | p03645 | u599547273 | 1533363419 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 275 | n, m = map(int, input())
ab = [tuple(map(int, input().split(" "))) for i in range(m)]
from_one, to_n = set(), set()
for ab_i in ab:
if ab_i[0] == 1:
from_one.add(ab_i[1])
elif ab_i[0] == n:
from_one.add(ab_i[1])
print("POSSIBLE" if from_one | to_n else "IMPOSSIBLE") |
s894942436 | p03645 | u224983328 | 1532459672 | Python | Python (3.4.3) | py | Runtime Error | 645 | 11464 | 674 | N,M = map(int,input().split(" "))
first = []
second = []
flag = 0
end = True
for i in range(M):
a,b = map(int,input().split(" "))
if b == N:
second.append(a)
if a == 1:
first.append(b)
first.sort()
second.sort()
if len(first) == 0 or len(second) == 0:
print("IMPOSSIBLE")
else:
firsti = 0
sec... |
s738271926 | p03645 | u224983328 | 1532459447 | Python | Python (3.4.3) | py | Runtime Error | 609 | 11060 | 646 | N,M = map(int,input().split(" "))
first = []
second = []
flag = 0
end = True
for i in range(M):
a,b = map(int,input().split(" "))
if b == N:
second.append(a)
if a == 1:
first.append(b)
if len(first) == 0 or len(second) == 0:
print("IMPOSSIBLE")
else:
firsti = 0
secondi = 0
while(end == True... |
s564783792 | p03645 | u455696302 | 1530643965 | Python | Python (3.4.3) | py | Runtime Error | 949 | 64560 | 558 | N,M = map(int,input().split())
a = []
tmp = []
for i in range(M):
tmp = list(map(str,input().split()))
a.append(list(tmp))
siCheck = [0 for i in range(N)]
inCheck = [0 for i in range(N)]
for i in range(N):
if a[i][0] == '1':
siCheck[int(a[i][1])-1] = True
else:
siCheck[int(a[i][1])-1] ... |
s999131960 | p03645 | u455696302 | 1530643629 | Python | Python (3.4.3) | py | Runtime Error | 950 | 64560 | 558 | N,M = map(int,input().split())
a = []
tmp = []
for i in range(M):
tmp = list(map(str,input().split()))
a.append(list(tmp))
siCheck = [0 for i in range(N)]
inCheck = [0 for i in range(N)]
for i in range(M):
if a[i][0] == '1':
siCheck[int(a[i][1])-1] = True
else:
siCheck[int(a[i][1])-1] ... |
s677506549 | p03645 | u455696302 | 1530643590 | Python | Python (3.4.3) | py | Runtime Error | 956 | 66608 | 558 | N,M = map(int,input().split())
a = []
tmp = []
for i in range(M):
tmp = list(map(str,input().split()))
a.append(list(tmp))
siCheck = [0 for i in range(N)]
inCheck = [0 for i in range(N)]
for i in range(M):
if a[i][0] == '1':
siCheck[int(a[i][1])-1] = True
else:
siCheck[int(a[i][1])-1] ... |
s723146014 | p03645 | u698479721 | 1530117470 | Python | Python (3.4.3) | py | Runtime Error | 877 | 51804 | 617 | import sys
N,M=map(int,input().split())
grid = []
for i in range(M):
array = list(map(int, input().strip().split(' ')))
grid.append(array)
pre = []
pos = []
for ships in grid:
if ships[0] == 1:
pre.append(ships[1])
if ships[1] == N:
pos.append(ships[0])
if pre == [] or pos == []:
print('IMPOSSIBLE... |
s197024891 | p03645 | u698479721 | 1530116376 | Python | Python (3.4.3) | py | Runtime Error | 745 | 51748 | 383 | import sys
N,M=map(int,input().split())
grid = []
for i in range(N):
array = list(map(int, input().strip().split(' ')))
grid.append(array)
pre = []
pos = []
for ships in grid:
if ships[0] == 1:
pre.append(ships[1])
if ships[1] == N:
pos.append(ships[0])
pre.sort()
for islands in pre:
if islands in... |
s166520549 | p03645 | u064246852 | 1529998362 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 11436 | 625 | n,m = map(int,input().split())
ahoge = []
hanege = []
for i in range(m):
ai,bi = map(int,input().split())
if ai == 1:
ahoge.append(bi)
if bi == n:
hanege.append(ai)
ahoge.sort()
hanege.sort()
def bis(i):
under = 0
upper = len(hanege)
l = (under+upper)//2
while under <= upper:... |
s297313429 | p03645 | u807772568 | 1526341055 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 522 | import collections
da = list(map(int,input().split()))
a[] = []
b[] = []
for i in range(da[1]):
k[i] = list(map(int,input().split()))
for i in range(da[1]):
if k[i][0] == 1 or k[i][1] == 1:
a.append(k[i])
for i in range(da[1]):
if k[i][0] == da[0]or k[i][1] == da[0]:
b.append(k[i])
a = list(set(a... |
s940038243 | p03645 | u807772568 | 1526340950 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 490 | import collections
da = list(map(int,input().split()))
a[] = []
b[] = []
for i in range(da[1]):
k[i] = list(map(int,input().split()))
for i in range(da[1]):
if k[i][0] == 1 or k[i][1] == 1:
a.append(k[i])
for i in range(da[1]):
if k[i][0] == da[0]or k[i][1] == da[0]:
b.append(k[i])
a = list(set(... |
s352743982 | p03645 | u807772568 | 1526340757 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 483 | import collections
da = list(map(int,input().split()))
a[] = []
b[] = []
for i in range(da[1]):
k[i] = list(map(int,input().split()))
for i in range(da[1]):
if k[i][0] == 1 or k[i][1] == 1:
a.append(k[i])
for i in range(da[1]):
if k[i][0] == da[0]or k[i][1] == da[0]:
b.append(k[i])
a = list(set(a... |
s527137399 | p03645 | u909643606 | 1524713103 | Python | Python (3.4.3) | py | Runtime Error | 752 | 40960 | 345 | n,m=[int(i) for i in input().split()]
p=[[0 for i in range(2)] for j in range(n)]
a=[0 for i in range(n+1)]
for i in range(m):
p[i]=[int(i) for i in input().split()]
for i in range(m):
if p[i][0]==1:
a[p[i][1]]+=1
elif p[i][1]==n:
a[p[i][0]]+=1
if max(a)>=2:
print("POSSIBLE")
else... |
s587723565 | p03645 | u909643606 | 1524711070 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2111 | 122408 | 437 | n,m=[int(i) for i in input().split()]
p=[[0 for i in range(2)] for j in range(n)]
for i in range(m):
p[i]=[int(i) for i in input().split()]
#隣接リスト
l = [[] for i in range(n+1)]
for pi in p: #0-originedに注意、l[0]は空
l[pi[0]].append(pi[1])
l[pi[1]].append(pi[0])
count=0
for i in l[1]:
if i in... |
s462532524 | p03645 | u909643606 | 1524710576 | Python | Python (3.4.3) | py | Runtime Error | 2107 | 61304 | 437 | n,m=[int(i) for i in input().split()]
p=[[0 for i in range(2)] for j in range(n)]
for i in range(m):
p[i]=[int(i) for i in input().split()]
#隣接リスト
l = [[] for i in range(n+1)]
for pi in p: #0-originedに注意、l[0]は空
l[pi[0]].append(pi[1])
l[pi[1]].append(pi[0])
count=0
for i in l[1]:
if i in... |
s783179021 | p03645 | u503901534 | 1524585010 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 375 | n, m = map(int,input().split())
boolins =[]
for i in range(n):
boolins.append(0)
for i in range(m):
xxx = list(map(int,input().split()))
if xxx[0] == 1:
boolins[xxx[1]] = boolins[xxx[1]] + 1
elif xxx[1] == n :
boolins[xxx[0]] boolins[xxx[0]]+ 1
else
None
if 2 in booli... |
s278208755 | p03645 | u503901534 | 1524583656 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 403 | n, m = map(int,input().split())
tbin_o = []
tbin_1 = []
tbin_n = []
for i in range(m):
xxx = list(map(int,input().split()))
if xxx[0] == 1:
tbin_1.append(xxx[1]):
elif xxx[1] == n :
tbin_n.append(xxx[0])
else:
None
aaa = 0
for i in tbin_1:
if i in tbin_n:
aaa =... |
s142288336 | p03645 | u503901534 | 1524582970 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 500 | n, m = map(int,input().split())
tbin_o = []
for i in range(m):
xxx = list(map(int,input().split()))
tbin_o.append(xxx)
tbin_2 = []
for i in range(len(tbin_o)):
if tbin_o[i][0] == 1 or tbin_o[i][1] == n:
tbin_2.append(tbin_o[i])
aaa = 0
for j in range(len(tbin_2)):
for l in range(len(tbin... |
s466550123 | p03645 | u503901534 | 1524582839 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 492 | n, m = map(int,input().split())
tbin_o = []
for i in range(m):
xxx = list(map(int,input().split()))
tbin.append(xxx)
tbin_2 = []
for i in range(len(tbin_o)):
if tbin_o[i][0] == 1 or tbin_o[i][i] == n:
tbin_2.append(tbin_o[i])
aaa = 0
for j in range(len(tbin_2)):
for l in range(len(tbin_2)):
... |
s528137284 | p03645 | u729707098 | 1521602436 | Python | Python (3.4.3) | py | Runtime Error | 1158 | 40204 | 266 | n,m = (int(i) for i in input().split())
x = [[int(i) for i in input().split()] for i in range(n)]
x.sort()
a = []
for i in x:
if i[0]==1:
a.append(i[1])
else:
break
for j in a:
if [j,n] in x:
m = 0
print("POSSIBLE")
break
if m != 0:
print("IMPOSSIBLE") |
s402945448 | p03645 | u030726788 | 1520000237 | Python | Python (3.4.3) | py | Runtime Error | 2107 | 51108 | 595 | import sys
n,m=map(int,input().split())
INF=10**15
d={}
for i in range(m):
a,b=map(int,input().split())
a-=1
b-=1
d.setdefault(a,[]).append(b)
d.setdefault(b,[]).append(a)
dist=[INF for i in range(n)]
dist[0]=0
queue=[]
for i in d[0]:
queue.insert(0,i)
dist[i]=1
while(len(queue)):
x=queue.pop()
if(x=... |
s480244176 | p03645 | u612721349 | 1504745197 | Python | PyPy3 (2.4.0) | py | Runtime Error | 169 | 38640 | 287 | from collections import defaultdict
d = defaultdict([0])
goal, n = map(int, input().split())
for _ in range(n):
f, t = map(int, input().split())
d[f].append(t)
d[t].append(f)
for current in d[1]:
if goal in d[current]:
print("POSSIBLE")
break
else:
print("IMPOSSIBLE") |
s132485468 | p03645 | u612721349 | 1504744288 | Python | PyPy3 (2.4.0) | py | Runtime Error | 165 | 38640 | 286 | from collections import defaultdict
d = defaultdict([])
goal, n = map(int, input().split())
for _ in range(n):
f, t = map(int, input().split())
d[f].append(t)
d[t].append(f)
for current in d[1]:
if goal in d[current]:
print("POSSIBLE")
break
else:
print("IMPOSSIBLE") |
s148095182 | p03645 | u612721349 | 1504744182 | Python | PyPy3 (2.4.0) | py | Runtime Error | 164 | 38256 | 298 | import defaultdict from collections
d = defaultdict([])
goal, n = map(int, input().split())
for _ in range(n):
from, to = map(int, input().split())
d[from].append(to)
d[to].append(from)
for current in d[1]:
if goal in d[current]:
print("POSSIBLE")
break
else:
print("IMPOSSIBLE") |
s138482147 | p03645 | u612721349 | 1504744007 | Python | PyPy3 (2.4.0) | py | Runtime Error | 160 | 38388 | 299 | import defaultdict from collections
d = defaultdict([])
goal, n = map(int, input().split())
for _ in range(n):
from, to = map(int, input().split())
d[from].append[to]
d[to].append[from]
for current in d[1]:
if goal in d[current]:
print("POSSIBLE")
break
else:
print("IMPOSSIBLE") |
s617109745 | p03645 | u010110540 | 1503933927 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 248 | N, M = int(input())
set_a, set_b = set(), set()
for i in range(M):
a, b = map(int, input().split())
if a == 1:
set_a.add(b)
if b == N:
set_b.add(a)
if set_a & set_b:
print('POSSIBLE')
else:
print('IMPOSSIBLE')
|
s473867945 | p03645 | u160414758 | 1503636929 | Python | Python (3.4.3) | py | Runtime Error | 345 | 19460 | 445 | from sys import stdin
input = stdin.readline
N,M = map(int,(input().split()))
ans = "IMPOSSIBLE"
ls = {}
f = [False]*M
for m in range(M):
a,b = map(int,(input().split()))
ls[a-1] = b-1
if a-1 == 0 and b-1 == N-1:
ans = "POSSIBLE"
if a-1 == 0:
f[a-1] = True
for m in range(M):
... |
s951876777 | p03645 | u160414758 | 1503636886 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 432 | from sys import stdin
input = stdin.readline
N,M = map(int,(input().split()))
ans = "IMPOSSIBLE"
ls = {}
f = [False]*M
for m in range(M):
a,b = map(int,(input().split()))
ls[a-1] = b-1
if a-1 == 0 and b-1 == N-1:
ans = "POSSIBLE"
if a-1 == 0:
f[a-1] = True
for m in range(M):
... |
s768402713 | p03645 | u370413678 | 1503570401 | Python | Python (3.4.3) | py | Runtime Error | 143 | 3060 | 216 | N, M = map(int, input().split())
a={}
b={}
for i in range(M):
k,l=map(int, input().split())
if k==1:
a.add(k)
if l==N:
b.add(l)
if a&b:
print("POSSIBLE")
else:
print("IMPOSSIBLE")
|
s092116807 | p03645 | u370413678 | 1503570275 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 223 | N, M = map(int, raw_input().split())
a={}
b={}
for i in range(M):
k,l=map(int, raw_input().split())
if k==1:
a.add(k)
if l==N:
b.add(l)
if a&b:
print("POSSIBLE")
else:
print("IMPOSSIBLE") |
s106652576 | p03645 | u370413678 | 1503570167 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 226 | N, M = map(int, raw_input().split())
a={}
b={}
for i in range(M):
k,l=map(int, raw_input().split())
if k==1:
a.add(k)
if l==1:
b.add(l)
if a&b:
print("POSSIBLE")
else:
print("IMPOSSIBLE")
|
s751295088 | p03645 | u370413678 | 1503570105 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 236 | N, M = map(int, raw_input().split())
a={}
b={}
for i in range(M):
k,l=a.append(map(int, raw_input().split()))
if k==1:
a.add(k)
if l==1:
b.add(l)
if a&b:
print("POSSIBLE")
else:
print("IMPOSSIBLE")
|
s638214022 | p03645 | u160414758 | 1503546222 | Python | Python (3.4.3) | py | Runtime Error | 846 | 39296 | 428 | N,M = map(int,(input().split()))
ans = "IMPOSSIBLE"
ls = [[] for m in range(M)]
for m in range(M):
a,b = map(int,(input().split()))
ls[m].append(a-1)
ls[m].append(b-1)
if a-1 == 0 and b == N-1:
ans = "POSSIBLE"
if a-1 == 0:
ls[m].append("P")
else:
ls[m].append("I")... |
s267440269 | p03645 | u343437894 | 1502467408 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 5012 | 444 | N, M = map(int, input().split(" "))
c = []
d = []
for i in range(0, M):
a, b = map(int, input().split(" "))
if a == 1:
c = c + [b]
elif b == N:
d = d + [a]
c.sort()
d.sort()
j, k = 0, 0
for i in range(1, N):
if (j > len(c)) or (k > len(d)):
print("IMPOSSIBLE")
break
... |
s407524315 | p03645 | u343437894 | 1502467372 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 4956 | 444 | N, M = map(int, input().split(" "))
c = []
d = []
for i in range(0, M):
a, b = map(int, input().split(" "))
if a == 1:
c = c + [b]
elif b == N:
d = d + [a]
c.sort()
d.sort()
j, k = 0, 0
for i in range(1, N):
if (i > len(c)) or (j > len(d)):
print("IMPOSSIBLE")
break
... |
s548881702 | p03645 | u343437894 | 1502466357 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 5116 | 314 | N, M = map(int, input().split(" "))
ab = []
for i in range(0, M):
ab = ab + list(map(int, input().split(" ")))
c = list(map(lambda y: y[1], filter(lambda x: x[0] == 1, ab)))
d = len(filter(lambda y: y[0] in c, filter(lambda x: x[1] == N, ab)))
if d > 0:
print("POSSIBLE")
else:
print("IMPOSSIBLE")
|
s441944743 | p03645 | u736675286 | 1501890616 | Python | Python (3.4.3) | py | Runtime Error | 919 | 113452 | 537 | # -*- coding: utf-8 -*-
N, M = input().split()
islands = []
for i in range(int(M)):
islands.append(map(int, input().split()))
print(str(islands))
first = []
second = []
for node in islands:
if (node[0] == 1):
first.append(node)
if (node[1] == N):
second.append(node)
isPosiible = False
f... |
s628486310 | p03645 | u085883871 | 1501632212 | Python | Python (3.4.3) | py | Runtime Error | 577 | 18948 | 545 | def solve(n, m, a, b):
islands = sets()
for i in range(m):
if(a[i] == 1):
islands.append(b[i])
if(b[i] == 1):
islands.append(a[i])
for i in range(m):
if(a[i] == n and b[i] in islands):
return "POSSIBLE"
if(b[i] == n and a[i] in islands):
... |
s161647097 | p03645 | u650245944 | 1501547211 | Python | Python (3.4.3) | py | Runtime Error | 256 | 3064 | 296 | #!/usr/bin
# -*- coding="utf-8" -*-
c1 = []
c2 = []
q = input().split()
for i in range(int(q[1])):
n = input()
for j in range(n):
m = j.split()
if m[0] == "1":
c1.append(m[1])
if m[1] == q[0]:
c2.append(m[0])
if set(c1) & set(c2):
print("POSSIBLE")
else:
print("INPOSSIBLE") |
s586664864 | p03645 | u650245944 | 1501543569 | Python | Python (3.4.3) | py | Runtime Error | 261 | 17308 | 294 | #!/usr/bin
# -*- coding="utf-8" -*-
c1 = []
c2 = []
q = input().split()
n = [input() for i in range(int(q[1]))]
for j in range(n):
m = j.split()
if m[0] == "1":
c1.append(m[1])
if m[1] == q[0]:
c2.append(m[0])
if set(c1) & set(c2):
print("POSSIBLE")
else:
print("INPOSSIBLE") |
s927101482 | p03645 | u650245944 | 1501543282 | Python | Python (3.4.3) | py | Runtime Error | 263 | 17416 | 301 | #!/usr/bin
# -*- coding="utf-8" -*-
c1 = []
c2 = []
q = input().split()
n = [input() for i in range(int(q[1]))]
for j in range(n):
m = j.split()
if m[0] == "1":
c1.append(m[1])
if m[1] == q[0]:
c2.append(m[0])
if set(c1).intersection(c2):
print("POSSIBLE")
else:
print("INPOSSIBLE") |
s042331600 | p03645 | u650245944 | 1501542812 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 307 | #!/usr/bin
# -*- coding="utf-8" -*-
c1 = []
c2 = []
q = input().split()
n = [input() for i in range(q[1])]
for j in range(n):
m = j.split()
if m[0] == "1":
c1.append(m[1])
if m[1] == q[0]:
c2.append(m[0])
for l in len(c2):
if c1[l] in c2:
print("POSSIBLE")
break
print("INPOSSIBLE") |
s013180418 | p03645 | u607437307 | 1501540542 | Python | Python (3.4.3) | py | Runtime Error | 69 | 10868 | 739 | #coding:utf-8
import sys
def main():
n, m = sys.stdin.readline().strip().split(" ")
n = int(n)
m = int(m)
vis = map(lambda _: False, list(range(m+1)))
ans = False
for i in range(m):
a, b = sys.stdin.readline().strip().split(" ")
a = int(a)
b = int(b)
if (a =... |
s248348895 | p03645 | u607437307 | 1501530262 | Python | Python (3.4.3) | py | Runtime Error | 68 | 10868 | 738 | #coding:utf-8
import sys
def main():
n, m = sys.stdin.readline().strip().split(" ")
n = int(n)
m = int(m)
vis = map(lambda _: False, list(range(m+1)))
ans = False
for i in range(m):
a, b = sys.stdin.readline().strip().split(" ")
a = int(a)
b = int(b)
if (a =... |
s374102126 | p03645 | u150117535 | 1501470664 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 266 | set1=set()
setn=set()
for i in [None]*M:
ipt=[int(x) for x in input().split()]
if 1 in ipt:
set1 = set1.union(ipt)
if N in ipt:
setn = setn.union(ipt)
if set1.symmetric_difference(setn):
print("POSSIBLE")
else:
print("IMPOSSIBLE") |
s572963783 | p03645 | u796424048 | 1501458599 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 371 | n,m = map(int,input().split())
des = [0]*(n+1)
a = 1
for i in range(0,m):
b = (list(map(int,input().split()))
if b[0] == 1:
des[b[1]] += 1
if des[b[1]] == 2:
print('possible')
a = 0
break
if b[1] == n:
des[b[0]] += 1
if des[b[0]] == 2:
print ('possible')
... |
s693678082 | p03645 | u796424048 | 1501455924 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 381 | n, m = map(int, input().split())
des= [0]*(n+1)
a = 1
for i in range(0, m):
b = (list(map(int, input().split())))
if b[0] == 1:
des[b[1]] += 1
if des[b[1]] == 2:
print('POSSIBLE')
a = 0
break
if b[1] == n:
des[b[0]] += 1
if des[b[0]] == 2:
print('POSSIBLE')
... |
s242044768 | p03645 | u796424048 | 1501455832 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 408 | n, m = map(int, input().split())
des= [0]*(n+1)
a = 1
for i in range(0, m):
b = (list(map(int, input().split())))
if b[0] == 1:
des[b[1]] += 1
if des[b[1]] == 2:
print('POSSIBLE')
a = 0
break
if b[1] == n:
des[b[0]] += 1
if des[b[0]] == 2:
... |
s621454281 | p03645 | u796424048 | 1501455750 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 386 | # coding: utf-8
N, M = tuple(map(int, input().split()))
graph = [ [] for i in range(N+1)]
for i in range(M):
a, b = tuple(map(int, input().split()))
graph[a].append(b)
graph[b].append(a)
res = "IMPOSSIBLE"
for i in range(2, N):
if 1 in graph[i] and N... |
s580948598 | p03645 | u785205215 | 1501386945 | Python | Python (3.4.3) | py | Runtime Error | 679 | 6320 | 389 | n, m = (int(i) for i in input().split())
bool_1 =[False for i in range(m)]
bool_n =[False for i in range(m)]
for i in range(m):
a, b = (int(i)-1 for i in input().split())
if a == 0:
bool_1[b] = True
if b == n-1:
bool_n[a] = True
ans = "IMPOSSIBLE"
for i in range(len(bool_1)):
if bool_1... |
s378819525 | p03645 | u785205215 | 1501386389 | Python | Python (3.4.3) | py | Runtime Error | 649 | 6320 | 400 | n, m = (int(i) for i in input().split())
bool_1 =[False for i in range(m)]
bool_n =[False for i in range(m)]
for i in range(m):
a, b = (int(i) for i in input().split())
if a == 1:
bool_1[b] = True
if b == n:
bool_n[a] = True
ans = "IMPOSSIBLE"
for i in range(len(bool_1)):
if bool_1[i] ... |
s831426390 | p03645 | u785205215 | 1501386187 | Python | Python (3.4.3) | py | Runtime Error | 167 | 3444 | 416 | n, m = (int(i) for i in input().split())
bool_1 =[False for i in range(20010)]
bool_n =[False for i in range(20010)]
for i in range(m):
a, b = (int(i) for i in input().split())
if a == 1:
bool_1[b] = True
if b == n:
bool_n[a] = True
ans = "IMPOSSIBLE"
for i in range(len(bool_1)):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.