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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s296343568 | p04033 | u813098295 | 1470017397 | Python | Python (2.7.6) | py | Runtime Error | 27 | 2568 | 213 | # coding: utf-8
a, b = map(int, raw_input().split())
ans = 1
for i in range(a, b+1):
ans *= i
if ans > 0:
print "Positive"
elif ans == 0:
print "Zero" #Fate/Zeroは神アニメ
else:
print "Negative" |
s230587180 | p04033 | u187945597 | 1470016044 | Python | Python (2.7.6) | py | Runtime Error | 28 | 2568 | 325 | n,m = map(int,raw_input().split())
arr = [1]*n
x = [False]*n
x[0] = True
counter = 0
for i in xrange(m) :
a,b = map(int,raw_input().split())
if x[a-1] :
x[b-1] = True
arr[a-1] -= 1
arr[b-1] += 1
if arr[a-1] == 0 :
x[a-1] = False
for j in x :
if j :
counter += 1
print cou... |
s137532058 | p04033 | u392220578 | 1470015462 | Python | PyPy3 (2.4.0) | py | Runtime Error | 350 | 43248 | 918 | n, l = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
dp = [[None] * n for _ in range(n)]
Aacc = [A[0]]
for i in range(1, n):
Aacc.append(Aacc[i - 1] + A[i])
def length(a, b):
return Aacc[b] - (Aacc[a - 1] if a > 0 else 0)
def search(a, b):
if dp[a][b] is None:
if a == b:... |
s983216948 | p04033 | u787696070 | 1470015044 | Python | Python (2.7.6) | py | Runtime Error | 27 | 2692 | 370 | a, b = map(int, raw_input().split(" "))
def f(arr):
return reduce(lambda x, y: x*y, arr)
if a == b:
if a < 0:
print "Negative"
elif a == 0:
print "Zero"
else:
print "Positive"
elif a == 0 or b == 0:
print "Zero"
elif a <= 0 and b > 0:
print "Zero"
elif f(range(a,b+1)) < ... |
s499258702 | p04033 | u531542790 | 1470014590 | Python | Python (3.4.3) | py | Runtime Error | 37 | 3064 | 329 | import sys
def main():
a = int(sys.argv[1])
b = int(sys.argv[2])
temp = 1
for i in range(a, b+1):
temp *= i
else:
if temp == 0:
print("Zero")
elif temp > 0:
print("Positive")
else:
print("Negative")
if __name__ == '__main__':
... |
s852248016 | p04033 | u749127958 | 1470014471 | Python | Python (2.7.6) | py | Runtime Error | 28 | 2568 | 258 | ab=raw_input().split()
a=int(ab[0])
b=int(ab[1])
num=1
if a <=0 and b>=0:
print 'Zero'
else:
for val in range(a,b+1,1):
num*=val
if num > 0:
print 'Positive'
elif num==0:
print 'Zero'
else :
print'Negative' |
s646099784 | p04033 | u277373937 | 1470014389 | Python | Python (2.7.6) | py | Runtime Error | 446 | 12060 | 436 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import numpy as np
parser = argparse.ArgumentParser(description='Range Product')
parser.add_argument('a', type=int)
parser.add_argument('b', type=int)
args = parser.parse_args()
a = args.a
b = args.b
if a > 0 and b > 0:
print 'Positive'
elif a < 0 an... |
s425480369 | p04033 | u531542790 | 1470014344 | Python | Python (3.4.3) | py | Runtime Error | 44 | 3064 | 343 | import sys
def main():
a = int(sys.argv[1])
b = int(sys.argv[2])
if a <= 0 and b >= 0:
print("Zero")
quit()
temp = 1
for i in range(a, b+1):
temp *= i
else:
if temp > 0:
print("Positive")
else:
print("Negative")
if __name__ == ... |
s176079846 | p04033 | u749127958 | 1470014214 | Python | Python (2.7.6) | py | Runtime Error | 34 | 2568 | 185 | ab=raw_input().split()
a=int(ab[0])
b=int(ab[1])
num=1
for val in range(a,b+1,1):
num*=val
if num > 0:
print 'Positive'
elif num==0:
print 'Zero'
else :
print'Negative' |
s695127748 | p04033 | u787696070 | 1470014147 | Python | Python (2.7.6) | py | Runtime Error | 32 | 2692 | 250 | a, b = map(int, raw_input().split(" "))
def f(arr):
return reduce(lambda x, y: x*y, arr)
if a == 0 or b == 0:
print "Zero"
elif f(range(a, b+1)) == 0:
print "Zero"
elif f(range(a,b+1)) < 0:
print "Negative"
else:
print "Positive" |
s407844971 | p04033 | u112002050 | 1470013746 | Python | Python (3.4.3) | py | Runtime Error | 36 | 3064 | 205 | a,b = [int(i) for i in input().split() ]
multi_sum = reduce(lambda x,y:x*y,[ for i in range(a,b) ])
if multi_sum > 0:
print("Positive")
elif multi_sum < 0:
print("Negative")
else:
print("Zero") |
s735044179 | p04033 | u842804748 | 1470013669 | Python | Python (2.7.6) | py | Runtime Error | 27 | 2568 | 292 | def main():
a, b = map(int, raw_input().split())
total = 1
for i in range(a, b+1):
total = total*i
if total > 0:
print 'Positive'
elif total < 0:
print 'Negative'
else:
print 'Zero'
if __name__ == "__main__":
main()
|
s085427511 | p04033 | u945080461 | 1470013647 | Python | Python (2.7.6) | py | Runtime Error | 28 | 2572 | 338 | a, b = map(int, raw_input().split())
if a <= 0 <= b:
print 'Zero'
elif a > 0:
print 'Positive'
elif (b - a) % 2:
print 'Positive'
else:
print 'Negative'
a, b = map(int, raw_input().split())
if a <= 0 <= b:
print 'Zero'
elif a > 0:
print 'Positive'
elif (b - a) % 2:
print 'Positive'
else:
... |
s150165978 | p04033 | u776189585 | 1470013395 | Python | Python (2.7.6) | py | Runtime Error | 27 | 2572 | 163 | a, b = map(int, raw_input().split())
if a < 0 and b < 0 and (b-a)%2 == 0:
print 'Negative'
elif 0 in range(a, b+1):
print 'Zero'
else:
print 'Positive' |
s800595532 | p04034 | u786150969 | 1598638714 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9092 | 623 | # AtCoder Grand Contest 002 B
N,M = map(int,input().split())
xn = [0] * M
yn = [0] * M
for i in range(M):
xn[i],yn[i] = map(int,input().split())
for i in range(M):
xn[i] -=1
yn[i] -=1
box = []
for i in range(N):
box.append([i,1,0])
box[0][2] = 1
a = [0]
for i in range(M):
if xn[i] in a:
... |
s398387912 | p04034 | u786150969 | 1598638633 | Python | Python (3.8.2) | py | Runtime Error | 254 | 30392 | 622 | # AtCoder Grand Contest 002 B
N,M = map(int,input().split())
xn = [0] * M
yn = [0] * M
for i in range(M):
xn[i],yn[i] = map(int,input().split())
for i in range(M):
xn[i] -=1
yn[i] -=1
box = []
for i in range(N):
box.append([i,1,0])
box[0][2] = 1
a = [0]
for i in range(M):
if xn[i] in a:
... |
s113921777 | p04034 | u786150969 | 1598638366 | Python | Python (3.8.2) | py | Runtime Error | 251 | 30400 | 614 | # AtCoder Grand Contest 002 B
N,M = map(int,input().split())
xn = [0] * M
yn = [0] * M
for i in range(M):
xn[i],yn[i] = map(int,input().split())
for i in range(M):
xn[i] -=1
yn[i] -=1
box = []
for i in range(N):
box.append([i,1,0])
box[0][2] = 1
a = [0]
for i in range(M):
if xn[i] in a:
... |
s595573075 | p04034 | u786150969 | 1598637151 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 30420 | 521 | # AtCoder Grand Contest 002 B
N,M = map(int,input().split())
xn = [0] * M
yn = [0] * M
for i in range(M):
xn[i],yn[i] = map(int,input().split())
for i in range(M):
xn[i] -=1
yn[i] -=1
box = []
for i in range(M):
box.append([i,1,0])
box[0][2] = 1
a = [0]
for i in range(M):
if xn[i] in a:
... |
s354860329 | p04034 | u786150969 | 1598621285 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 28960 | 462 | # AtCoder Grand Contest 002 B
N,M = map(int,input().split())
xn = [0] * M
yn = [0] * M
for i in range(M):
xn[i],yn[i] = map(int,input().split())
for i in range(M):
xn[i] -=1
yn[i] -=1
box = []
for i in range(M):
box.append([i,1])
a = [0]
for i in range(M):
if xn[i] in a:
box[i][1] -=1... |
s886748427 | p04034 | u786150969 | 1598621228 | Python | Python (3.8.2) | py | Runtime Error | 2209 | 31900 | 498 | # AtCoder Grand Contest 002 B
N,M = map(int,input().split())
xn = [0] * M
yn = [0] * M
for i in range(M):
xn[i],yn[i] = map(int,input().split())
for i in range(M):
xn[i] -=1
yn[i] -=1
print(xn)
print(yn)
box = []
for i in range(M):
box.append([i,1])
print(box)
a = [0]
for i in range(M):
... |
s810754928 | p04034 | u252828980 | 1598290984 | Python | Python (3.8.2) | py | Runtime Error | 28 | 10540 | 628 | n,m = map(int,input().split())
possible = [0]*n
kosuu = [1]*n
possible[0] = 1
L = []
if flag == False:
print(1)
exit()
for i in range(m):
x,y = L[i][0],L[i][1]
x,y = x-1,y-1
if kosuu[x] >=2 and possible[x] == 1:
possible[y] = 1
kosuu[x] -=1
kosuu[y] +=1
elif kosuu[x] ==... |
s865096071 | p04034 | u252828980 | 1598290912 | Python | Python (3.8.2) | py | Runtime Error | 210 | 23920 | 673 | n,m = map(int,input().split())
possible = [0]*n
kosuu = [1]*n
possible[0] = 1
L = []
for i in range(m):
x,y = map(int,input().split())
L.append((x,y))
for i in range(idx,m):
x,y = L[i][0],L[i][1]
x,y = x-1,y-1
if kosuu[x] >=2 and possible[x] == 1:
possible[y] = 1
kosuu[x] -=1
... |
s147892947 | p04034 | u252828980 | 1598210117 | Python | Python (3.8.2) | py | Runtime Error | 28 | 8912 | 742 | n,m = map(int,input().split())
possible = [0]*n
possible[0] = 1
kosuu = [1]*n
for i in range(m):
a,b = map(int,input().split())
a,b = a-1,b-1
if kosuu[a] >= 2 and possible[a] ==1:
possible[a] = 1
possible[b] = 1
kosuu[a] -=1
kosuu[b] +=1
elif kosuu[a] ==1 and ... |
s058960475 | p04034 | u562015767 | 1597859163 | Python | PyPy3 (7.3.0) | py | Runtime Error | 93 | 74516 | 566 | import numpy as np
n,m = map(int,input().split())
l = []
for _ in range(m):
a = list(map(int,input().split()))
l.append(a)
memo = np.zeros((n,2))
memo[0][1] = 1
for i in range(n):
memo[i][0] = 1
tmp1 = 0
tmp2 = 0
for j in range(m):
tmp1 = l[j][0]-1
tmp2 = l[j][1]-1
memo[tmp1][0] -= 1
me... |
s028825086 | p04034 | u816631826 | 1591897054 | Python | PyPy3 (2.4.0) | py | Runtime Error | 162 | 38512 | 1739 | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pl pair<long ,long >
#define pi pair<int ,int >
#define lb(v,x) lower_bound(v.begin(),v.end(),x)-v.begin();
#define ub(v,x) upper_bound(v.begin(),v.end(),x)-v.begin();
... |
s455578513 | p04034 | u314089899 | 1591064578 | Python | Python (3.4.3) | py | Runtime Error | 22 | 4656 | 611 | N,M = map(int, input().split())
balls_in_box = [0] + [1 for _ in range(1,N+1)]
red_ball_containable_box = set()
red_ball_containable_box.add(y)
for i in range(M):
x,y = map(int, input().split())
if x in red_ball_containable_box:
balls_in_box[x] -= 1
balls_in_box[y] += 1
red_ball_contai... |
s619898938 | p04034 | u314089899 | 1591064368 | Python | Python (3.4.3) | py | Runtime Error | 372 | 13304 | 907 | N,M = map(int, input().split())
balls_in_box = [0] + [1 for _ in range(1,N+1)]
#赤玉の初回移動までは捨てる
for i in range(M):
x,y = map(int, input().split())
if x == 1:
red_ball_containable_box = set()
red_ball_containable_box.add(y)
balls_in_box[x] -= 1
balls_in_box[y] += 1
start =... |
s042641955 | p04034 | u969708690 | 1590184467 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 211 | R=[0]
L=list()
N=int(input())
for i in range(N):
k=int(input())
L.append(k)
if k==0:
R.append(len(L))
S=sum(L)
R.append(N)
for i in range(len(R)-1):
if sum(L[R[i]:R[i+1]])%2==1:
S=S-1
print(S//2) |
s360160473 | p04034 | u969708690 | 1590174106 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 204 | R=list()
L=list()
N=int(input())
for i in range(N):
k=int(input())
L.append(k)
if k==0:
R.append(len(L))
S=sum(L)
for i in range(len(R)-1):
if sum(L[R[i]-1:R[i+1]])%2==1:
S=S-1
print(S//2) |
s521217682 | p04034 | u969708690 | 1590172876 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 8084 | 296 | N,M=map(int,input().split())
R=list()
R.append(1)
L=[1]*N
for i in range(M):
a,b=map(int,input().split())
L[a-1]=L[a-1]-1
L[b-1]=L[b-1]+1
if a in R:
if L[a-1]==0:
R.remove(a)
R.append(b)
for j in range(len(R)):
k=R[j]
if L[k-1]==0:
R.remove(k)
R=set(R)
print(len(R)) |
s427894312 | p04034 | u213580455 | 1590103777 | Python | Python (3.4.3) | py | Runtime Error | 2136 | 527204 | 1222 | redBalles = []
currentRedBall = 0
def putBall(i, balles, routes):
global redBalles
global currentRedBall
if i == len(routes):
redBalles[currentRedBall] = 1
return None
_from = routes[i][0]-1
_to = routes[i][1]-1
if balles[_from]%2 == 0:
balles[_from] -= 2
balles[... |
s236811391 | p04034 | u276204978 | 1590071465 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 405 | def solve():
N, M = map(int, input().split())
num = []
red = []
for i in range(N+1):
num.append(1)
red.append(0)
red[1] = 1
for _ range(M):
x, y = map(int, input().split())
if red[x] == 1:
red[y] = 1
num[x] -= 1
num[y] += 1
... |
s923281937 | p04034 | u287500079 | 1589835455 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 1135 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ... |
s971092719 | p04034 | u287500079 | 1589835249 | Python | PyPy3 (2.4.0) | py | Runtime Error | 168 | 38384 | 1135 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ... |
s948665329 | p04034 | u057993957 | 1589177580 | Python | Python (3.4.3) | py | Runtime Error | 417 | 28964 | 327 | n, m = list(map(int, input().split()))
xy = [list(map(int, input().split())) for i in range(m)]
ans = [1] * (n)
ans[0] = 1
ball = [0] * (n)
ball[0] = 1
for i in range(m):
x, y = xy[i]
ans[y-1] += 1
ans[x-1] -= 1
if ball[x-1]:
ball[y-1] = 1
if ans[x-1] == 0:
ball[x-1] = 0
print(su... |
s018296434 | p04034 | u577138895 | 1587470756 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2115 | 204408 | 1023 | import copy
N, M = map(int, input().split())
XY = []
for _ in range(M):
x, y = map(int, input().split())
XY.append([x - 1, y - 1])
ans = [0] * N
def dfs(depth, lst):
if depth == M:
for i in range(N):
if lst[i][0] == 1:
global ans
ans[i] = 1
... |
s165368692 | p04034 | u914797917 | 1587251535 | Python | Python (3.4.3) | py | Runtime Error | 366 | 12580 | 585 | N,M= map(int,input().split())
x = []
y = []
for i in range(M):
xi, yi = input().split()
x.append(int(xi))
y.append(int(yi))
L=[]
for i in range(N):
L.append(1)
R=[1]
for i in range(N-1):
R.append(0)
#print(R)
for i in range(M):
if R[x[i]-1]==1 and L[x[i]-1]==1:
R[x[i]-1]=0
L[x[i]-1]=0
R[y[i]... |
s321573602 | p04034 | u914797917 | 1587251391 | Python | Python (3.4.3) | py | Runtime Error | 367 | 12568 | 558 | N,M= map(int,input().split())
x = []
y = []
for i in range(M):
xi, yi = input().split()
x.append(int(xi))
y.append(int(yi))
L=[]
for i in range(N):
L.append(1)
R=[1]
for i in range(N-1):
R.append(0)
#print(R)
for i in range(M):
if R[x[i]-1]==1 and L[x[i]-1]==1:
R[x[i]-1]=0
L[x[i]-1]=0
R[y[i]... |
s537889954 | p04034 | u914797917 | 1587251016 | Python | Python (3.4.3) | py | Runtime Error | 330 | 12520 | 509 | N,M= map(int,input().split())
x = []
y = []
for i in range(M):
xi, yi = input().split()
x.append(int(xi))
y.append(int(yi))
L=[]
for i in range(N):
L.append(1)
R=[1]
for i in range(N-1):
R.append(0)
#print(R)
for i in range(M):
if R[i]==1 and L[i]==1:
R[i]=0
L[i]=0
R[y[i]-1]=1
L[y[i]-1]=... |
s816689874 | p04034 | u914797917 | 1587250774 | Python | Python (3.4.3) | py | Runtime Error | 349 | 12520 | 509 | N,M= map(int,input().split())
x = []
y = []
for i in range(M):
xi, yi = input().split()
x.append(int(xi))
y.append(int(yi))
L=[]
for i in range(N):
L.append(1)
R=[1]
for i in range(N-1):
R.append(0)
#print(R)
for i in range(M):
if R[i]==1 and L[i]==1:
R[i]=0
L[i]=0
R[y[i]-1]=1
L[y[i]-1]=... |
s176806771 | p04034 | u545368057 | 1585911676 | Python | Python (3.4.3) | py | Runtime Error | 355 | 4596 | 296 | N,M = map(int, input().split())
balls = [1]*N
reds = [False]*N
reds[0] = [True]
for i in range(M):
x,y = map(int, input().split())
x -= 1
y -= 1
balls[x] -= 1
balls[y] += 1
if reds[x]:
reds[y] = True
if balls[x] == 0:
reds[x] = False
print(sum(reds)) |
s663479674 | p04034 | u066455063 | 1577156018 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 287 | N, M = map(int, input().split())
action = [list(map(int, input().split())) for i in range(M)]
for i in range(M):
if action[i][0] == 1 and action[i][1] == 2:
N -= 1
elif i != 1:
if action[i][0] int action and action[i][1] in action:
N -= 1
print(N)
|
s866352109 | p04034 | u209619667 | 1576779179 | Python | Python (3.4.3) | py | Runtime Error | 29 | 6064 | 270 | A,B = map(int,input().split())
b = []
Zeroflag = False
count = 0
for i in range(A,B+1,1):
b.append(i)
if 0 in b:
zeroflag = True
for i in b:
if i < 0:
count += 1
if zeroflag:
print('Zero')
elif count %2 == 0:
print('Positive')
else:
print('Negative')
|
s162049048 | p04034 | u896741788 | 1575258438 | Python | Python (3.4.3) | py | Runtime Error | 343 | 7020 | 242 | n,m=map(int,input().split())
a=[1]*n
ans=set([1])
for i in range(m):
x,y=map(int,input().split())
if a[x-1]==0:continue
else:
a[x-1]-=1
a[y-1]+=1
if x in ans:
ans.add(y)
if a[x-1]==0:ans.rempve(x)
print(len(ans)) |
s767844490 | p04034 | u896741788 | 1575258109 | Python | Python (3.4.3) | py | Runtime Error | 365 | 12776 | 272 | n,m=map(int,input().split())
aru=1
a=[1]*n
ans=set([1])
for i in range(m):
x,y=map(int,input().split())
if a[x-1]==0:continue
else:
a[x-1]-=1
a[y-1]+=1
if aru==x:
aru=y
if a[x-1]!=0:
ans.add(x)
else:ans.remove(x)
print(len(ans)) |
s428685353 | p04034 | u896741788 | 1575258030 | Python | Python (3.4.3) | py | Runtime Error | 342 | 3828 | 269 | n,m=map(int,input().split())
aru=1
a=[1]*n
ans=set()
for i in range(m):
x,y=map(int,input().split())
if a[x-1]==0:continue
else:
a[x-1]-=1
a[y-1]+=1
if aru==x:
aru=y
if a[x-1]!=0:
ans.add(x)
else:ans.remove(x)
print(len(ans)) |
s883381447 | p04034 | u936985471 | 1574983551 | Python | Python (3.4.3) | py | Runtime Error | 366 | 4596 | 253 | n,m=map(int,input().split())
b=[1]*n
red=[False]*n
red[0]=True
for i in range(m):
x,y=map(int,input().split())
if not b[x]:
continue
x,y=x-1,y-1
b[y]+=1
red[y]=red[x]
b[x]-=1
if b[x]==0:
red[x]=False
print(red.count(True))
|
s355417581 | p04034 | u905582793 | 1574744428 | Python | PyPy3 (2.4.0) | py | Runtime Error | 634 | 67160 | 337 | N, M = map(int, input().split(' '))
X = []
for i in range(N):
X.append(list(map(int, input().split(' '))))
num_b = [i+1 for i in range(N)]
psb = [0]*N
psb[0] = 1
for i in X:
num_b[i[0]] -= 1
num_b[i[1]] += 1
if num_b[i[0]] == 0:
psb[i[0]] = 0
if psb[i[0]] == 1:
psb[i[1]] == 1
pri... |
s478745960 | p04034 | u905582793 | 1574744365 | Python | PyPy3 (2.4.0) | py | Runtime Error | 566 | 66776 | 348 | N, M = map(int, input().split(' '))
X = []
for i in range(N):
X.append(list(map(int, input().split(' '))))
num_b = [i+1 for i in range(N)]
psb = [0]*N
psb[0] = 1
for i in X:
num_b[[i][0]] -= 1
num_b[[i][1]] += 1
if num_b[[i][0]] == 0:
psb[[i][0]] = 0
if psb[[i][0]] == 1:
psb[[i][1]... |
s234445841 | p04034 | u374802266 | 1574228532 | Python | Python (3.4.3) | py | Runtime Error | 358 | 27300 | 188 | n,m=map(int,input().split())
a=[]
b=[0]
for i in range(n):
a.append(list(map(int,input().split())))
for i in range(m):
if a[i][0] in b:
b.append(a[i][1])
print(len(set(b))) |
s118853308 | p04034 | u405256066 | 1572153850 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3828 | 528 | from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
box = [1]*(N+1)
flag = False
n1_pass = set()
n1_now = 0
for _ in range(M):
x,y = [int(x) for x in stdin.readline().rstrip().split()]
box[x] -= 1
box[y] += 1
if box[x] == 0:
n1_pass.remove(x)
if x == 1 and not fla... |
s789470210 | p04034 | u598229387 | 1571804851 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 100780 | 212 | n,m=map(int,input().split())
li=[1]*(n+1)
se=set()
se.add(1)
for i in range(m):
x,y=map(int,input().split())
li[x]-=1
li[y]+=1
print(li)
if x in se:
se.add(y)
if li[x]==0:
se.remove(x)
print(len(se)) |
s379349310 | p04034 | u598229387 | 1571804785 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 98412 | 223 | n,m=map(int,input().split())
print(n,m)
li=[1]*(n+1)
se=set()
se.add(1)
for i in range(m):
x,y=map(int,input().split())
li[x]-=1
li[y]+=1
print(li)
if x in se:
se.add(y)
if li[x]==0:
se.remove(x)
print(len(se)) |
s040572485 | p04034 | u655048024 | 1559507024 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3888 | 299 | N,M = map(int,input().split())
box_1 = [1 for j in range(N)]
box_2 = [0 for k in raneg(N)]
box_2[0] = 1
for i in range(M):
x,y = map(int,input().split())
box_1[x]-=1
box_1[y]+=1
box_2[y]=1
counter = 0
for l in range(N):
if(box_1[j]>=1)and(box_2[j]==1):
counter+=1
print(counter)
|
s237418468 | p04034 | u652081898 | 1558098195 | Python | Python (3.4.3) | py | Runtime Error | 352 | 4596 | 293 | n, m = map(int, input().split())
stack = [1]*n
p = [False]*n
p[0] = True
for i in range(m):
x, y = map(int, input().split())
stack[x-1] -= 1
stack[y-1] += 1
p[y-1] = p[x-1] or p[y-1]
if stack[0] == 0:
p[0] = False
for i in p:
if i:
ans += 1
print(ans) |
s640729277 | p04034 | u652081898 | 1558072952 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 4716 | 316 | n, m = map(int, input().split())
stack = [1]*n
p = [1]
for i in range(m):
x, y = map(int, input().split())
stack[x-1] -= 1
stack[y-1] += 1
if x in p:
p.append(y)
if p[0] == 1:
p.remove(1)
ps = list(set(p))
ans = 0
for i in ps:
if stack[i-1] != 0:
ans += 1
print(ans) |
s187588700 | p04034 | u426108351 | 1554413423 | Python | Python (3.4.3) | py | Runtime Error | 348 | 4760 | 371 | N, M = map(int, input().split())
red = [False for i in range(N+1)]
red[1] = True
box = [1 for i in range(N+1)]
for i in range(M):
x, y = map(int, input().split())
if red[x]:
red[y] = True
box[x] -= 1
box[y] += 1
if box[i] == 0:
red[x] = False
ans = 0
for i in range(1, N+1):
if ... |
s679473728 | p04034 | u426108351 | 1554413354 | Python | Python (3.4.3) | py | Runtime Error | 362 | 4656 | 371 | N, M = map(int, input().split())
red = [False for i in range(N+1)]
red[1] = True
box = [1 for i in range(N+1)]
for i in range(M):
x, y = map(int, input().split())
if red[x]:
red[y] = True
box[x] -= 1
box[y] += 1
if box[i] == 0:
red[i] = False
ans = 0
for i in range(1, N+1):
if ... |
s733201427 | p04034 | u950708010 | 1550007074 | Python | Python (3.4.3) | py | Runtime Error | 397 | 4596 | 263 | n,m = (int(i) for i in input().split())
dp = [0]*(m+1)
ball = [1]*(m+1)
dp[0] = 1
for i in range(m):
x,y = (int(i) for i in input().split())
if dp[x-1] == 1:
dp[y-1] = 1
ball[x-1] -= 1
ball[y-1] += 1
if ball[x-1] == 0:
dp[x-1] = 0
print(sum(dp)) |
s500273099 | p04034 | u844789719 | 1547258639 | Python | Python (3.4.3) | py | Runtime Error | 374 | 24740 | 375 | N, M = [int(_) for _ in input().split()]
XY = [[int(_) - 1 for _ in input().split()] for _ in range(M)]
red = [False] * M
red[0] = True
num = [1] * M
for x, y in XY:
num[x] -= 1
num[y] += 1
if red[x] == True:
red[y] = True
if num[x] == 0:
red[x] = False
print(sum(red))
# http:... |
s365399235 | p04034 | u183509493 | 1544459714 | Python | Python (3.4.3) | py | Runtime Error | 297 | 3888 | 169 | n, m = map(int,input().split())
f = [False for _ in range(n)]
f[0] = True
for i in range(m):
x, y = map(int,input().split())
f[y] = f[y] or f[x]
print(f.count(True)) |
s583870527 | p04034 | u785989355 | 1542009711 | Python | Python (3.4.3) | py | Runtime Error | 404 | 4760 | 432 |
N,M = list(map(int,input().split()))
ball_list = [1 for i in range(N)]
flag_list = [False for i in range(N)]
flag_list[0] = True
for i in range(M):
x,y = list(map(int,input().split()))
if flag_list[x-1]:
flag_list[y-1]=True
if ball_list[x-1]==1:
flag_list[x-1]=False
ball_list[... |
s540607210 | p04034 | u108808596 | 1530821172 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 1712 | #include <bits/stdc++.h>
using namespace std;
#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>
typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;
typedef vector... |
s924833917 | p04034 | u562016607 | 1522479553 | Python | Python (3.4.3) | py | Runtime Error | 411 | 13568 | 475 | N,M=map(int,input().split())
x=[0 for i in range(M)]
y=[0 for i in range(M)]
for i in range(M):
x[i],y[i]=map(int,input().split())
x[i]-=1
y[i]-=1
a=[0 for i in range(N)]
a[0]=N**N
c=[0 for i in range(N)]
c[0]=1
b=[1 for i in range(N)]
for i in range(M):
b[x[i]]-=1
b[y[i]]+=1
t=a[x[i]]
a[x[i... |
s438985060 | p04034 | u562016607 | 1522479195 | Python | Python (3.4.3) | py | Runtime Error | 419 | 12756 | 395 | N,M=map(int,input().split())
x=[0 for i in range(M)]
y=[0 for i in range(M)]
for i in range(M):
x[i],y[i]=map(int,input().split())
x[i]-=1
y[i]-=1
a=[0 for i in range(N)]
a[0]=N**N
b=[1 for i in range(N)]
for i in range(M):
b[x[i]]-=1
b[y[i]]+=1
t=a[x[i]]
a[x[i]]-=t/(b[x[i]]+1)
a[y[i]]+=... |
s062152863 | p04034 | u562016607 | 1522479130 | Python | Python (3.4.3) | py | Runtime Error | 424 | 14400 | 379 | N,M=map(int,input().split())
x=[0 for i in range(M)]
y=[0 for i in range(M)]
for i in range(M):
x[i],y[i]=map(int,input().split())
x[i]-=1
y[i]-=1
a=[0 for i in range(N)]
a[0]=N**N
c=[0 for i in range(N)]
c[0]=1
b=[1 for i in range(N)]
for i in range(M):
b[x[i]]-=1
b[y[i]]+=1
t=a[x[i]]
a[x[i... |
s622761225 | p04034 | u163073599 | 1470942438 | Python | Python (3.4.3) | py | Runtime Error | 41 | 3064 | 424 | n, l = (int(s) for s in input().strip().split(' '))
an = []
for a in range(0,l):
an.append(input().strip().split())
box=[[1,0] for i in range(n)]
box[0][1] = 1
for move in an:
box[int(move[0])-1][0] -= 1
box[int(move[1])-1][0]+=1
if box[int(move[0])-1][1] == 1:
box[int(move[1])-1][1]= 1... |
s981767992 | p04034 | u107077660 | 1470082361 | Python | Python (3.4.3) | py | Runtime Error | 39 | 3064 | 197 | L, H = map(int,input().split())
N = int(input())
A =[]
for i in range(2,N+2):
A.append(int(input()))
for i in range(N):
if A[i] < L:
print(L-A[i])
elif A[i] <= H:
print(0)
else:
print(-1) |
s252666040 | p04034 | u945080461 | 1470014995 | Python | Python (2.7.6) | py | Runtime Error | 27 | 2568 | 419 | def main():
n, m = map(int, stdin.readline().split())
dat = map(int, stdin.read().split(), repeat(10, 2 * m))
a = [0] + [2] * n
a[1] = 1
for i in xrange(m):
x, y = dat[i*2], dat[i*2+1]
if a[x] == 0:
continue
a[y] += 2
if a[x] & 1 and a[y] & 1 ^ 1:
a[y... |
s181960045 | p04034 | u579875569 | 1470014207 | Python | Python (3.4.3) | py | Runtime Error | 50 | 3064 | 1489 | #include <iostream>
#include <queue>
#include <map>
#include <list>
#include <vector>
#include <string>
#include <limits>
#include <cassert>
#include <fstream>
#include <cstring>
#include <bitset>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <ciso646>
#include <array>
#includ... |
s968452177 | p04035 | u969708690 | 1590269607 | Python | Python (3.4.3) | py | Runtime Error | 133 | 18020 | 319 | import sys
K=10**10
N,L=map(int,input().split())
T=list(map(int,input().split()))
for i in range(N-1):
if T[i]+T[i+1]>=L:
K=i
print("Possible")
break
if K==10**10:
print("Impossible")
K=K+1
R=list(range(1,K))
R.extend(list(range(K+1,N)))
R.append(K)
R=list(map(str,R))
for i in range(N-1):
print(R[i]) |
s412114528 | p04035 | u969708690 | 1590269275 | Python | Python (3.4.3) | py | Runtime Error | 78 | 18020 | 225 | N,L=map(int,input().split())
T=list(map(int,input().split()))
for i in range(N-1):
if T[i]+T[i+1]>=L:
K=i
break
K=K+1
R=list(range(1,K))
R.extend(list(range(K+1,N)))
R.append(K)
R=list(map(str,R))
print(" ".join(R)) |
s608268456 | p04035 | u145600939 | 1587196645 | Python | Python (3.4.3) | py | Runtime Error | 44 | 14052 | 287 | n,l = map(int,input().split())
A = list(map(int,input().split()))
x = -1
for i in range(n-1):
if a[i]+a[i+1] >= l:
x = i
break
if x == -1:
print('Impossible')
else:
print('Possible')
for i in range(x-1):
print(i+1)
for i in range(n-1,x,-1):
print(i)
print(x)
|
s397682094 | p04035 | u373958718 | 1573461609 | Python | Python (3.4.3) | py | Runtime Error | 198 | 23108 | 306 | import numpy as np
n,l=map(int,input().split())
a=list(map(int,input().split()))
flag=False;idx=0
for i in range(n-1):
if a[i]+a[i+1]>=l:
flag=True
idx=i
if not Flag:
print("Impossible")
exit(0)
print("Possible")
for x in range(idx):
print(x+1)
for x in reversed(range(idx+1)):
print(x+1) |
s089798597 | p04035 | u227082700 | 1572406386 | Python | Python (3.4.3) | py | Runtime Error | 42 | 14060 | 228 | n,l=map(int,input().split())
a=list(map(int, input().split()))
for i in range(n-1):
if a[i]+a[i+1]>=L:
print("Possible")
for j in range(i):print(j+1)
for j in range(n-1,i,-1):print(i)
exit()
print("Impossible") |
s304728538 | p04035 | u310233294 | 1572383079 | Python | Python (3.4.3) | py | Runtime Error | 73 | 14620 | 465 | N, L = map(int, input().split())
A = list(map(int, input().split()))
b = [0] * (N - 1)
c = N - 1
pos = 1
for i in range(N - 1):
l = A[i] + A[i + 1]
if l >= L:
j = i
b[j] = c
c -= 1
break
else:
pos = 0
print('Impossible')
if pos:
for i in range(j - 1, -1, -1):
... |
s651543389 | p04035 | u310233294 | 1572383051 | Python | Python (3.4.3) | py | Runtime Error | 130 | 14596 | 473 | N, L = map(int, input().split())
A = list(map(int, input().split()))
b = [0] * (N - 1)
c = N - 1
pos = 1
for i in range(N - 1):
l = A[i] + A[i + 1]
if l >= L:
j = i
b[j] = c
c -= 1
break
else:
pos = 0
print('Impossible')
if pos:
for i in range(j - 1, -1, -1):
... |
s290927906 | p04035 | u905203728 | 1570482067 | Python | Python (3.4.3) | py | Runtime Error | 214 | 22472 | 428 | n,l=map(int,input().split())
A=list(map(int,input().split()))
A=list([i+1,A[i]] for i in range(n))
cnt,cnt_list=0,[]
ans=[]
for x,y in A:
cnt +=y
cnt_list.append(x)
if x==n:cnt_list.pop()
if cnt>=l:
ans.append(cnt_list.pop())
for i in cnt_list:
ans.append(i)
cnt=0
... |
s171769898 | p04035 | u802963389 | 1570299069 | Python | Python (3.4.3) | py | Runtime Error | 135 | 14440 | 287 | from collections import deque
N, L = map(int, input().split())
c = list(map(int, input().split()))
for i in range(len(c)-1):
if c[i] + c[i+1] >= L:
pos = i + 1
break
else:
print("Impossible")
for i in range(1,pos):
print(i)
for i in range(len(c) -1, pos, -1):
print(i) |
s261181442 | p04035 | u941753895 | 1570165120 | Python | Python (3.4.3) | py | Runtime Error | 146 | 16820 | 1080 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): ... |
s996626830 | p04035 | u708255304 | 1568730358 | Python | Python (3.4.3) | py | Runtime Error | 125 | 14180 | 362 | N, L = map(int, input().split())
A = list(map(int, input().split()))
ans_index = -1
for i in range(N-1):
if A[i] + A[i+1] >= L:
ans_index = i
break
if ans_index == -1:
print('Impossible')
exit()
print('Possible')
ans_index += 1
for i in range(1, ans_index):
print(i)
for i in range(N-... |
s536236829 | p04035 | u708255304 | 1568729685 | Python | Python (3.4.3) | py | Runtime Error | 68 | 14392 | 365 | N, L = map(int, input().split())
A = list(map(int, input().split()))
ans_index = -1
for i in range(N-1):
if A[i] + A[i+1] >= L:
ans_index = i
break
ans = list(range(1, i)).extend(list(i+1, N-1)).append(ans_index)
if ans_index == -1:
print('Impossible')
else:
for i in range(len(ans)):
... |
s602150417 | p04035 | u645250356 | 1568264471 | Python | Python (3.4.3) | py | Runtime Error | 221 | 26396 | 1048 | from collections import Counter,defaultdict
import sys,heapq,bisect,math,itertools,string,queue
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.read... |
s853753207 | p04035 | u174273188 | 1568162552 | Python | Python (3.4.3) | py | Runtime Error | 112 | 14304 | 449 | def resolve():
n, l = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
if a[i] + a[i + 1] >= l:
last = i
print("Possible")
for j in range(last):
print(i)
for j in range(last + 1, n):
print... |
s341509919 | p04035 | u623687794 | 1568129529 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 377 | import sys
sys.setrecursionimit(200000)
n,l=map(int,input().split())
r=list(map(int,input().split()))
last=0;tiepoint=0
for i in range(n-1):
if r[i]+r[i+1]>last:
last=r[i]+r[i+1]
tiepoint=i
if last>=l:
print("Possible")
for i in range(tiepoint-1):
print(i+1)
for i in range(tiepoint+1,n)[::-1]:
... |
s643557358 | p04035 | u623687794 | 1568128694 | Python | PyPy3 (2.4.0) | py | Runtime Error | 165 | 38256 | 343 | import sys
sys.setrecursionimit(200000)
n,l=map(int,input().split())
r=list(map(int,input().split()))
last=0;tiepoint=0
for i in range(n-1):
if r[i]+r[i+1]>last:
last=r[i]+r[i+1]
tiepoint=i
if last>=l:
print("Possible")
for i in range(n-1):
if i==tiepoint:continue
print(i+1)
print(tiepoint+1)
el... |
s764097409 | p04035 | u623687794 | 1567913608 | Python | PyPy3 (2.4.0) | py | Runtime Error | 172 | 38384 | 275 | n,l=map(int,input().split())
r=list(map(int,input().split()))
last=0;tiepoint=0
for i in range(n-1):
if r[i]+r[i+1]>last:
last=r[i]+r[i+1]
tiepoint=i
if last>=l:print("Possible")
for i in range(n):
if i==tiepoint:continue
print(i)
else:print("Impossible") |
s931678861 | p04035 | u606045429 | 1566947136 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 249 | N, L, *A = map(int, open(0).read().split())
k = -1
for i in range(N - 1):
if A[i] + A[i + 1] >= L:
k = i + 1
break
if k == -1:
print("Impossible")
else:
print("Possible", *range(1, k), *range(N - 1, k, -1), k, sep="\n") |
s415108793 | p04035 | u391731808 | 1565230762 | Python | Python (3.4.3) | py | Runtime Error | 189 | 16612 | 385 | N,L = map(int,input().split())
*A, = map(int,input().split())
S = [0]*(N+1)
for i,a in enumerate(A): S[i+1] = S[i] + a
ans = []
i=0
j=N-1
while i<j:
if S[j+1]-S[i] < L:
1/0
print("Impossible")
break
if A[i] <= A[j]:
ans.append(i+1)
i+=1
else:
ans.append(j)
... |
s975511096 | p04035 | u163320134 | 1562946063 | Python | Python (3.4.3) | py | Runtime Error | 144 | 14076 | 376 | n,l=map(int,input().split())
arr=list(map(int,input().split()))
pos=0
tmp=0
for i in range(n-1):
if (arr[i]+arr[i+1])>tmp:
pos=i
tmp=(arr[i]+arr[i+1])
if tmp<l:
print('Impossible')
else:
print('Possible')
ans=[]
for i in range(pos):
ans.append(i+1)
for i in range(n,pos+1):
ans.append(i)
an... |
s664587050 | p04035 | u391331433 | 1552754330 | Python | PyPy2 (5.6.0) | py | Runtime Error | 128 | 49352 | 1150 | import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
if fileobject == None :
return raw_input
else:
return fileobject.readline
def main():
if len(sys.argv) > 1:
f = open(sys.argv[1])
else:
f = None
read_func = get_read_func... |
s434345256 | p04035 | u054106284 | 1548439492 | Python | Python (3.4.3) | py | Runtime Error | 136 | 14056 | 384 | N, L = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
P = "Possible"
for i in range(N-1):
if a[i] + a[i+1] >= L:
start = i
break
else:
P = "Impossible"
ans = [start]
if start > 0:
ans += list(range(start))
if start != N-2:
ans += reversed(list(range(start+1, N-1)))
ans.rever... |
s057107410 | p04035 | u183509493 | 1544460426 | Python | Python (3.4.3) | py | Runtime Error | 30 | 11132 | 145 | n,l = map(int,input().split())
a = map(int,input().split())
a.sort()
if a[n - 1] + a[n - 2] >= l:
print("Possible")
else:
print("Impossible") |
s625520525 | p04035 | u177398299 | 1539127495 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 280 | N, L = map(int, input().split())
a = list(map(int, input().split()))
end = 0
for i in range(N - 1):
if a[i] + a[i + 1] >= L:
end = i + 1
break
else:
print('Impossible')
exit()
print('Possible')
print(*range(1, end), *reversed(range(end, N)), sep='\n') |
s302780021 | p04035 | u619631862 | 1522626838 | Python | PyPy3 (2.4.0) | py | Runtime Error | 238 | 70500 | 490 | def i1():
return int(input())
def i2():
return [int(i) for i in input().split()]
[n,l]=i2()
a=i2()
s=[a[0]]
b=[]
d=[]
for i in range(1,n):
s.append(s[-1]+a[i])
if a[i-1]+a[i]<l:
b.append(i)
else:
d.append(i)
c=0
if not n-1 in b:
if s[-1]-s[b[-1]-1]>=l:
c+=1
if s[b[0]-1]>=l:
c+=1
for i in ... |
s383491109 | p04035 | u392220578 | 1470019243 | Python | PyPy3 (2.4.0) | py | Runtime Error | 376 | 43120 | 1296 | #include <bits/stdc++.h>
using namespace std;
int n, l;
vector<int> a;
int length(int x, int y)
{
return a[y] - (x > 0 ? a[x - 1] : 0);
}
int dp[10001][10001] = {};
int search(int x, int y)
{
if (x == y) {
return -1;
}
if (dp[x][y] == 0) {
if (length(x, y) < l) {
dp[x][y]... |
s769761145 | p04035 | u392220578 | 1470019238 | Python | PyPy3 (2.4.0) | py | Runtime Error | 370 | 42992 | 1296 | #include <bits/stdc++.h>
using namespace std;
int n, l;
vector<int> a;
int length(int x, int y)
{
return a[y] - (x > 0 ? a[x - 1] : 0);
}
int dp[10001][10001] = {};
int search(int x, int y)
{
if (x == y) {
return -1;
}
if (dp[x][y] == 0) {
if (length(x, y) < l) {
dp[x][y]... |
s361756711 | p04035 | u392220578 | 1470019186 | Python | PyPy3 (2.4.0) | py | Runtime Error | 386 | 43120 | 1296 | #include <bits/stdc++.h>
using namespace std;
int n, l;
vector<int> a;
int length(int x, int y)
{
return a[y] - (x > 0 ? a[x - 1] : 0);
}
int dp[10001][10001] = {};
int search(int x, int y)
{
if (x == y) {
return -1;
}
if (dp[x][y] == 0) {
if (length(x, y) < l) {
dp[x][y]... |
s244435441 | p04035 | u392220578 | 1470019053 | Python | PyPy3 (2.4.0) | py | Runtime Error | 400 | 43120 | 1296 | #include <bits/stdc++.h>
using namespace std;
int n, l;
vector<int> a;
int length(int x, int y)
{
return a[y] - (x > 0 ? a[x - 1] : 0);
}
int dp[10001][10001] = {};
int search(int x, int y)
{
if (x == y) {
return -1;
}
if (dp[x][y] == 0) {
if (length(x, y) < l) {
dp[x][y]... |
s665188217 | p04035 | u107077660 | 1470016267 | Python | Python (3.4.3) | py | Runtime Error | 38 | 3064 | 279 | N, L = map(int, input().split())
a = [map(int, input().split())]
b = 0
c = 0
for i in range(N-1):
if a[i] + a[i+1] >= L:
print("Possible")
b = 1
c = i
break
else:
print("Impossible")
if b = 1:
for i in range(c+1):
print(i+1)
for i in range(N, c+1, -1):
print(i+1) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.