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
s167591155
p03937
u539517139
1562860533
Python
Python (3.4.3)
py
Runtime Error
17
3064
403
h,w=map(int,input().split()) a=[list(input())+'.' for _ in range(h)] d='.'*(w+1) a.append(d) x=1 i=0;j=0 while i!=h-1 or j!=w-1: if a[i+1][j]=='#': if a[i][j+1]=='#': x=0 break else: i=i+1 a[i][j]='.' else: if a[i][j+1]=='.': x=0 break else: j=j+1 a[i][j]='.' if x==1: if '#' in a: x=0 print('Possible' if x==1 else 'Impossible')
s143644886
p03937
u539517139
1562075823
Python
Python (3.4.3)
py
Runtime Error
18
3064
284
h,w=map(int,input().split()) d='.'*(w+2) a=[d] for _ in range(h): s='.'+input()+'.' a.append(s) a.append(d) x='Possible' a[h][w+1]='#' for i in range(1,w+1): for j in range(1,h+1): if a[j][i]=='#': if a[j][i+1]==a[j+1][i]: x='Impossible' break print(x)
s648022357
p03937
u405256066
1560223265
Python
Python (3.4.3)
py
Runtime Error
18
3064
586
import itertools from sys import stdin H,W = [int(x) for x in stdin.readline().rstrip().split()] data = [] for _ in range(H): data.append(list(input())) flag = False for j in (itertools.product([0,1],repeat=int((H+W-2)/2))): route_flag = True right = 0 down = 0 for k in j: if k == 1: right += 1 else: down += 1 if data[down][right] == ".": route_flag = False if route_flag: flag = True if data[0][0] == ".": flag = False if flag: print("Possible") else: print("Impossible")
s069684496
p03937
u405256066
1560223174
Python
Python (3.4.3)
py
Runtime Error
19
3188
579
import itertools from sys import stdin H,W = [int(x) for x in stdin.readline().rstrip().split()] data = [] for _ in range(N): data.append(list(input())) flag = False for j in (itertools.product([0,1],repeat=(H+W-2))): route_flag = True right = 0 down = 0 for k in j: if k == 1: right += 1 else: down += 1 if data[down][right] == ".": route_flag = False if foute_flag: flag = True if data[0][0] == ".": flag = False if flag: print("Possible") else: print("Impossible")
s163767438
p03937
u532966492
1558409283
Python
Python (3.4.3)
py
Runtime Error
17
3064
303
H,W=map(int,input().split()) G=[input()+"." for _ in range(4)]+["."*(W+1)] p=[0,0] while(p!=[H-1,W-1]): if G[p[0]+1][p[1]]==G[p[0]][p[1]+1]: print("Impossible") break elif G[p[0]+1][p[1]]=="#": p=[p[0]+1,p[1]] else: p=[p[0],p[1]+1] else: print("Possible")
s680418508
p03937
u062147869
1557695324
Python
PyPy3 (2.4.0)
py
Runtime Error
186
38640
862
from operator import itemgetter H,W=map(int,input().split()) A=[list([i for i in input()]) for i in range(H)] B=[0]*H C=[0]*W for i in range(H): num=0 for j in range(W): if A[i][j]=='#': num+=1 B[i]=num for j in range(W): num=0 for i in range(H): if A[i][j]=='#': num+=1 C[j]=num L=[] for i in range(H): for j in range(W): if B[i]>=2 and C[j]>=2 and A[i][j]=='#': L.append((i,j)) L=sorted(L,key=itemgetter(1)) L=sorted(L,key=itemgetter(0)) for i in range(len(L)-1): flag=True if i%2==0: if L[i][0]==L[i+1][0] and L[i][1]<L[i+1][1]: continue flag=False elif i%2==1: if L[i][1]==L[i+1][1] and L[i][0]<L[i+1][0]: continue flag=False #print(L) if flag: print('Possible') if not flag: print('Imossible')
s361929945
p03937
u026155812
1556508879
Python
Python (3.4.3)
py
Runtime Error
18
3064
518
H, W = map(int, input().split()) A = [] for i in range(H): A.append(input() + '.') A.append('.'*(W+1)) def dfs(x, y): d = [[0,1], [1,0]] num = 0 for dx, dy in d: x += dx y += dy if A[y][x] == '#': num += 1 if num != 1: return 'Impossible' else: for dx, dy in d: x += dx y += dy if A[y][x] == '#': dfs(x, y) if dfs(0, 0) == 'Impossible': print('Impossible') else: print('Possible')
s712175123
p03937
u721316601
1554684789
Python
Python (3.4.3)
py
Runtime Error
34
3316
436
H, W = list(map(int, input().split())) A = [input() +'.' for i in range(H)] + ['.' * (H+2)] idxs = [[0, 0]] route = 0 while len(idxs): y, x = idxs.pop(0) if y == H-1 and x == W-1 and A[y][x] == '#': route += 1 if A[y+1][x] == '#': idxs.append([y+1, x]) if A[y][x+1] == '#': idxs.append([y, x+1]) if route > 1: break if route == 1: print('Possible') else: print('Impossible')
s025354406
p03937
u721316601
1554677528
Python
Python (3.4.3)
py
Runtime Error
38
3316
404
H, W = list(map(int, input().split())) A = [input() +'.' for i in range(H)] + ['.' * (H+2)] idxs = [[0, 0]] route = 0 while len(idxs): y, x = idxs.pop(0) if y == H-1 and x == W-1 and A[y][x] == '#': route += 1 if A[y+1][x] == '#': idxs.append([y+1, x]) if A[y][x+1] == '#': idxs.append([y, x+1]) if route == 1: print('Possible') else: print('Impossible')
s185781826
p03937
u227082700
1553834871
Python
Python (3.4.3)
py
Runtime Error
18
2940
134
h,w=map(int,input().split());c=0 for i in range(h): a=input().split(".") c+=len(a) print("Possible"if h+w-1==ans else"Impossible")
s235543249
p03937
u785989355
1553142160
Python
Python (3.4.3)
py
Runtime Error
18
3064
309
N=int(input()) p = list(map(int,input().split())) q = [0 for i in range(N)] for i in range(N): q[p[i]-1]=i A = 0 B = 10**9+1 ans_a = [] ans_b = [] for i in range(N): A+=q[i] if i!=0: B-=q[i-1] A+=1 B-=1 ans_a.append(A) ans_b.append(B) print(*ans_a) print(*ans_b)
s067528701
p03937
u782654209
1553048601
Python
Python (3.4.3)
py
Runtime Error
19
3188
1102
#AGC007 A ''' 問題 縦H行で横W列の盤面がある コマははじめ左上隅のマスに置かれており,右下隅に移動した 駒は1マスずつ上下左右に動ける 駒が通ったことのあるマスが提示されるので,駒が常に右または下にしか動いていなかったどうか判定せよ ただし通ったことのあるマスは'#',一度も通らなかったマスは'.'で与えられる 考察 各行0,1,...,i,...,H-1に対して'#'のマスが存在する範囲を[ai,bi]とする。ただし0<=ai<=bi<=W-1 このとき各0,1,...,j,...,H-2について b_j == a_(j+1) であればよい ''' import re H,W = map(int,input().split(' ')) A = [] ans = '' answers = ('Possible','Impossible') r = re.compile(r'\.*#+\.*') for i in range(H): s = input() if len(r.findall(s)) == 1: A.append(s) else: #'#'が2箇所以上にわかれていたらその時点でアウト ans = answers[1] break for i in range(H-1): if A[i].rfind('#') == A[i+1].find('#'): continue else: ans = answers[1] break if ans == '': ans = answers[0] print(ans)
s092442477
p03937
u782654209
1553048484
Python
Python (3.4.3)
py
Runtime Error
19
3188
1101
#AGC007 A ''' 問題 縦H行で横W列の盤面がある コマははじめ左上隅のマスに置かれており,右下隅に移動した 駒は1マスずつ上下左右に動ける 駒が通ったことのあるマスが提示されるので,駒が常に右または下にしか動いていなかったどうか判定せよ ただし通ったことのあるマスは'#',一度も通らなかったマスは'.'で与えられる 考察 各行0,1,...,i,...,H-1に対して'#'のマスが存在する範囲を[ai,bi]とする。ただし0<=ai<=bi<=W-1 このとき各0,1,...,j,...,H-2について b_j == a_(j+1) であればよい ''' import re H,W = map(int,input().split(' ')) A = [] ans = '' answers = ('Possible','Impossible') r = re.compile(r'\.*#+\.*') for i in range(H): s = input() #'#'が2箇所以上にわかれていたらその時点でアウト if len(r.findall(s)) == 1: A.append(s) else: ans = answers[1] break for i in range(H-1): if A[i].rfind('#') == A[i+1].find('#'): continue else: ans = answers[1] break if ans == '': ans = answers[0] print(ans)
s840565649
p03937
u852719059
1552017959
Python
Python (3.4.3)
py
Runtime Error
18
2940
164
h, w = map(int, input().split()) As = list(chain.from_iterable([list(input()) for i in range(h)])) print("Possible" if As.count("#") == h + w - 1 else "Impossible")
s192872235
p03937
u411858517
1551903880
Python
Python (3.4.3)
py
Runtime Error
18
3060
233
W, H = map(int, input().split()) L = [input() for _ in range(H)] count = 0 for i in range(H): for j in range(W): if L[i][j] == '#': count += 1 if count == W + H - 1: print('Possible') else: print('Impossible')
s485715397
p03937
u139629238
1551823488
Python
Python (3.4.3)
py
Runtime Error
18
3188
246
input_nums = [int(n) for n in input().slice(“ ”)] h = input_nums[0] w = input_nums[1] count = 0 for i in range(h): for c in input(): if c == “#”: count += 1 if count == h+w-1: print(“Possible”) else: print(“Impossible”)
s469918983
p03937
u777923818
1550666327
Python
PyPy3 (2.4.0)
py
Runtime Error
185
39408
501
from random import shuffle from collections import Counter def inpl(): return list(map(int, input().split())) #N = 20000 #P = list(range(1, N+1)) #shuffle(P) N = int(input()) P = inpl() A = [0]*N B = [0]*N S = [10**9 - N] * (N) for i, p in enumerate(P): S[p-1] += i A[0] = 1 B[0] = S[0] - 1 for i in range(1, N): A[i] = max(A[i-1] + 1, S[i] - B[i-1] + 1) B[i] = S[i] - A[i] for i in range(N-1): assert A[i] < A[i+1] assert B[i] > B[i+1] assert B[-1] > 0 print(*A) print(*B)
s240781004
p03937
u777923818
1550666175
Python
PyPy3 (2.4.0)
py
Runtime Error
191
38512
500
from random import shuffle from collections import Counter def inpl(): return list(map(int, input().split())) #N = 20000 #P = list(range(1, N+1)) #shuffle(P) N = int(input()) P = inpl() A = [0]*N B = [0]*N S = [10**9 - N] * (N) for i, p in enumerate(P): S[p-1] += i A[0] = 1 B[0] = S[0] - 1 for i in range(1, N): A[i] = max(A[i-1] + 1, S[i] - B[i-1] + 1) B[i] = S[i] - A[i] for i in range(N-1): assert A[i] < A[i+1] assert B[i] > B[i+1] assert B[-1] > 0 print(*A) print(*B)
s917744419
p03937
u375616706
1549582832
Python
Python (3.4.3)
py
Runtime Error
18
3060
239
# python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline H, W = map(int, input().split()) cnt=0 for _ in range(H): cnt+=l.count("#") if cnt==H+W-1: print("Possible") else: print("Impossible")
s855256156
p03937
u375616706
1549582737
Python
Python (3.4.3)
py
Runtime Error
18
3064
575
# python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline H, W = map(int, input().split()) grid = [["."]*(W+2) for _ in range(W+2)] for j in range(1, H+1): l = input() for i in range(len(l)-1): grid[j][i+1] = l[i] r = 1 c = 1 while r <= H and c <= W: if grid[r+1][c] == "#" and grid[r][c+1] == ".": r += 1 elif grid[r+1][c] == "." and grid[r][c+1] == "#": c += 1 elif r == H and c == W: ans = "Possible" break else: ans = "Impossible" break print(ans)
s347452947
p03937
u371467115
1547424299
Python
Python (3.4.3)
py
Runtime Error
18
2940
123
h,w=map(int,input().split()) c=0 for i in range(h): c+=input().count("#") print("Possible" if c=h+w-1 else "Impossible")
s557858178
p03937
u371467115
1547424122
Python
Python (3.4.3)
py
Runtime Error
18
2940
119
h,w=map(int,input().split()) c=0 for i in range(h): c+=input().count("#") print("Possible" if c=h+w-1: "Impossible")
s078936053
p03937
u371467115
1547424083
Python
Python (3.4.3)
py
Runtime Error
18
2940
117
h,w=map(int,input().split()) c=0 for i in range(h): c=input().count("#") print("Possible" if c=h+w-1: "Impossible")
s215772957
p03937
u787562674
1546480479
Python
Python (3.4.3)
py
Runtime Error
18
3064
585
H, W = map(int, input().split()) inputs = [input() for _ in range(H)] y = 0 x = 0 goal_y = H - 1 goal_x = W - 1 ans = 'Impossible' counts = 0 for item in inputs: counts += item.count('#') if counts != (H + W - 1): ans = 'Impossible' else: for i in range(H + W - 2): if 0 <= x <= W - 1 and inputs[y][x + 1] == '#': x = x + 1 elif 0 <= y <= H - 1 and inputs[y + 1][x] == '#': y = y + 1 else: ans = 'Impossible' break ans = 'Possible' if y == goal_y and x == goal_x else 'Impossible' print(ans)
s261510890
p03937
u787562674
1546479999
Python
Python (3.4.3)
py
Runtime Error
18
3064
566
H, W = map(int, input().split()) inputs = [input() for _ in range(H)] y = 0 x = 0 goal_y = H - 1 goal_x = W - 1 counts = 0 for item in inputs: counts += item.count('#') if counts != (H + W - 1): ans = 'Impossible' else: for i in range(H + W - 2): if 0 <= x <= W - 1 and inputs[y][x + 1] == '#': x = x + 1 elif 0 <= y <= H - 1 and inputs[y + 1][x] == '#': y = y + 1 else: ans = 'Impossible' break ans = 'Possible' if y == goal_y and x == goal_x else 'Impossible' print(ans)
s193498381
p03937
u787562674
1546479869
Python
Python (3.4.3)
py
Runtime Error
20
3064
492
H, W = map(int, input().split()) inputs = [input() for _ in range(H)] y = 0 x = 0 goal_y = H - 1 goal_x = W - 1 counts = 0 for item in inputs: counts += item.count('#') if counts != (H + W - 1): print('Impossible') else: for i in range(H + W - 2): if 0 <= x <= W - 1 and inputs[y][x + 1] == '#': x = x + 1 elif 0 <= y <= H - 1 and inputs[y + 1][x] == '#': y = y + 1 print('Possible' if y == goal_y and x == goal_x else 'Impossible')
s024619106
p03937
u853900545
1542907147
Python
Python (3.4.3)
py
Runtime Error
18
2940
158
h,w = map(int,input().split()) c = 0 for i in ranege(h): c += list(input()).count('#') if c == h+w-1: print('Possible') else: print('Imipossible')
s008725117
p03937
u729133443
1538628995
Python
Python (3.4.3)
py
Runtime Error
17
2940
391
from functools import lru_cache @lru_cache(maxsize=None) def search(i,j): global s,h,w if i==h-1and j==w-1:return 1 r=0 if i<h-1and s[i+1][j]=='#':r|=search(i+1,j) else if j<w-1and s[i][j+1]=='#':r|=search(i,j+1) if i>0and s[i-1][j]=='#':r=0 if j>0and s[i][j-1]=='#':r=0 return r h,w=map(int,input().split()) s=[input()for _ in[0]*h] print(('P'*search(0,0)or'Imp')+'ossible')
s320440967
p03937
u545411641
1527906266
Python
Python (3.4.3)
py
Runtime Error
17
3060
204
H, W = map(int, input().split()) A = [input() for _ in range(H)] pos = {x:0, y:0} cnt = 0 for i in range(H): cnt += A[i].count('#') if cnt == (H + W -1): print("Possible") else: print("Impossible")
s860784267
p03937
u545411641
1527906175
Python
Python (3.4.3)
py
Runtime Error
17
3060
204
H, W = map(int, input().split()) A = [input() for _ in range(H)] pos = {x:0, y:0} cnt = 0 for i in range(H): cnt += A[i].count('#') if cnt == (H + W -1): print("Possible") else: print("Impossible")
s821505043
p03937
u835482198
1500880778
Python
Python (3.4.3)
py
Runtime Error
18
3064
1025
import sys H, W = map(int, input().split()) m = [input() for i in range(H)] valid = True dx = [0, 0, 1, -1] dy = [-1, 1, 0, 0] for y in range(H): for x in range(W): if m[y][x] != '#': continue cnt = 0 for i in range(4): nx = x + dx[i] ny = y + dy[i] if 0 <= nx and nx < W and \ 0 <= ny and ny < H and m[ny][nx] == '#': cnt += 1 if cnt >= 3: valid = False print("Impossible") sys.exit() def rec(x, y): if x == W - 1 and y == H - 1: return True if m[y][x] != '#': return False dx = [0, 1] dy = [1, 0] valid = False for i in range(4): nx = x + dx[i] ny = y + dy[i] if 0 <= nx and nx < W and \ 0 <= ny and ny < H and m[ny][nx] == '#': ret = rec(nx, ny) if ret: return ret return False if rec(0, 0): print("Possible") else: print("Impossible")
s643978152
p03937
u941466476
1482693639
Python
Python (2.7.6)
py
Runtime Error
18
2692
270
# -*- coding: utf-8 -*- n = int(raw_input()) p = map(int,raw_input().split()) a = [i for i in xrange(1, n+1)] b = [i for i in reversed(xrange(1, n+1))] for i in p: count = 0 a[i] += count count += 1 for i in a: print i, print "" for i in b: print i,
s778315403
p03937
u886545507
1479739400
Python
Python (2.7.6)
py
Runtime Error
17
2568
147
#agc007a h,w=map(int(raw_input()) cnt=0 for i in range(h): cnt+=raw_input().count('#') if cnt==h+w-1 print 'Possible' else: print 'Impossible'
s066931557
p03937
u637175065
1479058740
Python
Python (3.4.3)
py
Runtime Error
24
3064
252
N = input() l = input().split() N=int(N) a=range(1,N+1) b=range(1,N+1) a=[i*N for i in a] b=[i*N for i in b] b.reverse() c=0 for i in l: i=int(i) b[i-1]+=c c+=1 for i in a: print(i,end=" ") print("") for i in b: print(i,end=" ")
s656957849
p03937
u278912056
1479048200
Python
PyPy2 (5.6.0)
py
Runtime Error
48
9584
661
def rl(proc=None): if proc is not None: return proc(sys.stdin.readline()) else: return sys.stdin.readline().rstrip() def srl(proc=None): if proc is not None: return map(proc, rl().split()) else: return rl().split() def fix(a): mn = min(a) - 1 return [x - mn for x in a] def main(): N = rl(int) p = srl(int) a = range(N) b = list(reversed(a)) for i, v in enumerate(p[1:], 1): a[v-1] += i for j in xrange(v, N): a[j] += i b[j] -= i print " ".join(map(str, fix(a))) print " ".join(map(str, fix(b))) if __name__ == '__main__': main()
s397102012
p03937
u226155577
1479009572
Python
PyPy2 (5.6.0)
py
Runtime Error
38
8944
442
n, e, t = map(int, raw_input().split()) X = map(int, raw_input().split()) if n > 2001: exit(1) ans = 0 bef = 0 bef_i = 0 d = [[0 for i in xrange(n)] for j in xrange(n)] for i in xrange(n): el = d[i] xi = X[i] for j in xrange(i, n): el[j] = max(2*(X[j] - xi), t) + X[j] - xi for i in xrange(n): for j in xrange(i): d[0][i] = min(d[0][j]+d[j+1][i]+(X[j+1]-X[j]), d[0][i]) print d[0][n-1]+ e - X[-1] + X[0]
s798867155
p03937
u085725262
1479008885
Python
Python (3.4.3)
py
Runtime Error
24
3188
571
import sys H, W = map(int, input().split()) matrix = [] for i in range(H): row = sys.stdin.readline() matrix.append(row) x=0 y=0 flag = True strResult="Possible" while((x<W-1) & (y<H-1) & flag): if matrix[y][x+1] == '#': x += 1 for y2 in range(y+1,H): if matrix[y2][x-1] == '#': strResult = "Impossible" flag = False break elif matrix[y+1][x] == '#': y += 1 for x2 in range(x+1,W): if matrix[y-1][x2] == '#': strResult = "Impossible" flag = false break else: strResult = "Impossible" flag = False print (strResult)
s105831004
p03937
u272028993
1479007049
Python
PyPy2 (5.6.0)
py
Runtime Error
37
8944
442
n=int(raw_input()) p=map(lambda x:int(x)-1,raw_input().split()) a=range(1,n+1) b=range(n,0,-1) for i in xrange(1,n): if p[i]>p[i-1]: diff=abs(a[p[i]]+b[p[i]]-(a[p[i-1]]+b[p[i-1]])) for j in xrange(p[i],n): a[j]=a[j]+diff+1 else: diff=abs(a[p[i]]+b[p[i]]-(a[p[i-1]]+b[p[i-1]])) for j in xrange(p[i],-1,-1): b[j]=b[j]+diff+1 print(" ".join(map(str,a))) print(" ".join(map(str,b)))
s208704442
p03937
u257374434
1479004810
Python
Python (3.4.3)
py
Runtime Error
24
3064
351
N = int(input()) P = [int(x) for x in input().split()] a = [i* 10**3+1 for i in range(N)] b= list(reversed(a)) for i in range(N): #P[i] =2* i p = P[i]-1 a[p]+=i print(" ".join(map(str,a)) ) print(" ".join(map(str,b)) ) def check(): tmp =0 for i in P: i-=1 print(tmp<a[i]+b[i]) tmp=a[i]+b[i] #check()
s954225843
p03937
u107077660
1479002675
Python
Python (3.4.3)
py
Runtime Error
23
3188
160
h, w = map(int, input().split()) ans = 0 for i in range(h): a = imput() ans += a.count("#") if ans == h + w - 1: print("Possible") else: print("Impossible")
s749622680
p03938
u693716675
1584666621
Python
Python (3.4.3)
py
Runtime Error
30
5492
184
n = int(input()) p = [int(i) for i in input().split()] a = [30000*i for i in range(n)] b = [30000*(n-i) for i in range(n)] for i,v in enumerate(p): a[v] += i print(*a) print(*b)
s918758046
p03938
u476604182
1583807543
Python
Python (3.4.3)
py
Runtime Error
17
2940
144
N, *P = map(int, open('0').read().split()) b = list(range(N*N, N-1, -N)) a = [0]*N for i,p in enumerate(P): a[p-1] = N*p+i print(*a) print(*b)
s905181808
p03938
u143509139
1575577352
Python
Python (3.4.3)
py
Runtime Error
22
5144
200
n=int(input()) p=list(map(int,input().split())) a = [0]*n b = [0]*n for i in range(n): a[i] = 10 ** 5 * (i + 1) + p b[i] = 10 ** 5 * (n - i) print(' '.join(map(str,a))) print(' '.join(map(str,b)))
s077064725
p03938
u832039789
1569796201
Python
Python (3.4.3)
py
Runtime Error
33
6748
180
n=int(input()) a=[i*40000 for i in range(n)] b=[i*40000 for i in range(n-1,-1,-1)] p=list(map(int,input().split())) for i in range(n): a[p[i]]+=i b[p[i]]+=i print(*a) print(*b)
s107339616
p03938
u123756661
1568520027
Python
PyPy3 (2.4.0)
py
Runtime Error
182
40688
178
n=int(input()) l=[int(i) for i in input().split()] b=[] for i in range(n): b.append(22000*i+1) a=b[:] b.reverse() for i in range(1,n): a[i[i]-1]+=1 print(*a) print(*b)
s116998264
p03938
u794250528
1567616607
Python
Python (3.4.3)
py
Runtime Error
17
2940
217
n = int(input()) p = [int(s) - 1 for s in input().split()] a = [40_000 * (i + 1) for i in range(n)] b = list(reversed(a)) for i in range(n): a[p[i]] += i print(' '.join(map(str, a))) print(' '.join(map(str, b)))
s005423923
p03938
u879870653
1562675009
Python
Python (3.4.3)
py
Runtime Error
31
5364
173
N = int(input()) P = list(map(int,input().split())) A = [i*N for i in range(1,N+1)] B = A[::-1] for i,p in enumerate(P) : A[p] += i B[p] += i print(*A) print(*B)
s291456756
p03938
u688126754
1559425555
Python
Python (3.4.3)
py
Runtime Error
22
5144
437
N = int(input()) p_lst = list(map(int, input().split())) p_arr = np.array(p_lst) - 1 a_arr = [N*i + 1 for i in range(N)] b_arr = [0]*N for i in range(N): b_arr[p_arr[i]] = N*(N - p_arr[i]) + i + 1 a_output = "" b_output = "" for i in range(N): a_output += str(a_arr[i]) b_output += str(b_arr[i]) if i == N-1: continue else: a_output += " " b_output += " " print(a_output) print(b_output)
s720464885
p03938
u785578220
1553744995
Python
Python (2.7.6)
py
Runtime Error
10
2568
220
a = int(input()) x = list(map(int,input().split())) t = range(1,a+1) A = [] B = [] for i in range(1,a+1): A.append(30000*i) B.append(30000*(a-i+1)) for i ,d in enumerate(x): A[d-1] -= a-i print(*A) print(*B)
s694273606
p03938
u785578220
1553744659
Python
Python (3.4.3)
py
Runtime Error
33
5476
186
a = int(input()) x = list(map(int,input().split())) t = range(1,a+1) A = [] B = [] for i in range(1,a+1): A.append(30000*i) B.append(30000*(a-i+1)+t[x[i-1]]) print(*A) print(*B)
s291672235
p03938
u785578220
1553744611
Python
Python (3.4.3)
py
Runtime Error
23
5144
189
a = int(input()) x = list(map(int,input().split())) t = [range(1,a+1)] A = [] B = [] for i in range(1,a+1): A.append(30000*i) B.append(30000*(a-i+1)+t[x[i-1]]) print(*A) print(*B)
s484205061
p03938
u785578220
1553744592
Python
Python (3.4.3)
py
Runtime Error
17
2940
187
a = int(input()) x = list(map(int,input().split())) t = [range(1,a+1)] A = [] B = [] for i in range(1,a+1): A.append(30000*i) B.append(30000*(a-i+1)+tpx[i-1]]) print(*A) print(*B)
s221768182
p03938
u427344224
1552654707
Python
Python (3.4.3)
py
Runtime Error
26
6208
268
N = int(input()) p_list = list(map(int, input().split())) r = {} for i in range(N): r[p_list[i]] = i + 1 a_list = [] b_list = [] for i in range(1, N + 1): a_list.append(30000 * i) b_list.append(30000 * (N - i) + r[i - 1]) print(*a_list) print(*b_list)
s505796486
p03938
u054106284
1550709710
Python
Python (3.4.3)
py
Runtime Error
17
3064
250
N = int(input) A = [int(i) for i in input().split()] a = [20000*i for i in range(N)] b = [20000*(N-i) for i in range(N)] for i in range(N): a[A[i]-1] += N-i-1 a = [str(i) for i in a] b = [str(i) for i in b] print(" ".join(a)) print(" ".join(b))
s423887628
p03938
u064408584
1550663512
Python
Python (3.4.3)
py
Runtime Error
26
5608
150
n=int(input()) x=list(map(int, input().split())) a=list(range(1,n+1)) b=list(range(n,0,-1)) for i,j in enumerate(b): b[j-1]+=i print(*a) print(*b)
s907874036
p03938
u214617707
1550348384
Python
Python (3.4.3)
py
Runtime Error
36
6820
225
N = int(input()) p = list(map(lambda x: int(x) - 1, input().split())) r = {} for i in range(N): r[p[i]] = i A = [30000 * i for i in range(1, N + 1)] B = [30000 * (N - i) + r[i] for i in range(1, N + 1)] print(A) print(B)
s736235633
p03938
u284854859
1544109409
Python
Python (3.4.3)
py
Runtime Error
33
5492
306
n = int(input()) p = list(map(int,input().split())) a = [0] * n b = [0] * n c = [] for i in range(n): a[i] = 30000*i b[i] = 30000*(n-i) for i in range(n): k = p[i] b[k] += i res = '' ans = '' for i in range(n): res += str(a[i]) + ' ' ans += str(b[i]) + ' ' print(res) print(ans)
s668091118
p03938
u785989355
1543969154
Python
Python (3.4.3)
py
Runtime Error
33
6252
230
N = int(input()) p = list(map(int,input().split())) q = [0 for i in range(N)] for i in range(N): q[p[i]-1]=i+1 a = [(i+1)*N for i in range(N)] b = [(N-i-1)*N + q[i] for i in range(N)] print(" ".join(a)) print(" ".join(b))
s274604881
p03938
u064408584
1539388556
Python
Python (3.4.3)
py
Runtime Error
17
2940
138
n=int(input()) c=list(map(int, input().split())) a=list(range(n,n**2+1,n)) b=a[::-1] for i in range(n): b[c[i]-1]+=i print(*a,'\n',*b)
s406495079
p03938
u690536347
1535749412
Python
Python (3.4.3)
py
Runtime Error
17
3064
277
n=int(input()) *l,=map(int,input().split()) *a,=range(1,n+1) b=a[::-1] for i,j in enumerate(l): b[j-1]+=i for i in range(1,n): if not b[i-1]>b[i]: df=b[i]-b[i-1]+1 b[i]-=df a[i]+=df if b[-1]<1: tg=abs(b[-1])+1 *b=map(lambda x:x+tg,b) print(*a) print(*b)
s582088996
p03938
u941466476
1482693655
Python
Python (2.7.6)
py
Runtime Error
33
4740
270
# -*- coding: utf-8 -*- n = int(raw_input()) p = map(int,raw_input().split()) a = [i for i in xrange(1, n+1)] b = [i for i in reversed(xrange(1, n+1))] for i in p: count = 0 a[i] += count count += 1 for i in a: print i, print "" for i in b: print i,
s677189423
p03938
u637175065
1479058830
Python
Python (3.4.3)
py
Runtime Error
30
5256
247
n = int(input()) a = list(map(int, input().split())) ra = [] for i in xrange(n): ra.append((i+1)*30000) rb = [] for i in xrange(n): rb.append((n-i)*30000+a[i]) for i in ra: print(i,end=" ") print("") for i in rb: print(i,end=" ")
s022699536
p03938
u637175065
1479058393
Python
Python (2.7.6)
py
Runtime Error
18
3076
224
n = int(input()) a = list(map(int, input().split())) ra = [] for i in xrange(n): ra.append((i+1)*30000) rb = [] for i in xrange(n): rb.append((n-i)*30000+a[i]) print ' '.join(map(str,ra)) print ' '.join(map(str,rb))
s472895158
p03938
u278912056
1479048212
Python
PyPy2 (5.6.0)
py
Runtime Error
52
10096
661
def rl(proc=None): if proc is not None: return proc(sys.stdin.readline()) else: return sys.stdin.readline().rstrip() def srl(proc=None): if proc is not None: return map(proc, rl().split()) else: return rl().split() def fix(a): mn = min(a) - 1 return [x - mn for x in a] def main(): N = rl(int) p = srl(int) a = range(N) b = list(reversed(a)) for i, v in enumerate(p[1:], 1): a[v-1] += i for j in xrange(v, N): a[j] += i b[j] -= i print " ".join(map(str, fix(a))) print " ".join(map(str, fix(b))) if __name__ == '__main__': main()
s404808224
p03939
u340781749
1479015120
Python
Python (3.4.3)
py
Runtime Error
767
198904
236
import sys sys.setrecursionlimit(200000) def solve(n, d, x): if not n: return 0 return d + (2 * n - 1) * x / 2 + solve(n - 1, ((n + 1) * d + 5 * x / 2) / n, (n + 2) * x / n) print(solve(*map(int, input().split())))
s875636672
p03940
u102461423
1571706916
Python
Python (3.4.3)
py
Runtime Error
478
13000
938
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from bisect import bisect_left N,E,T = map(int,readline().split()) X = [0] + list(map(int,read().split())) X2 = [2*x for x in X] INF = 10**18 def base_solution(): # これをseg木に乗せまーす dp = [0] * (N+1) for n in range(1,N+1): x = X[n] i = bisect_left(X2,2*x-T) # i-1番目まで戻る → 待ち時間なし # i番目まで戻る → 待ち時間発生 if i >= 1: t1 = min((dp[k]-X[k] for k in range(i-1,n)),default=INF)+x+T t2 = min((dp[k]-X[k]-2*X[k+1] for k in range(i-1)),default=INF)+3*x else: t1 = min((dp[k]-X[k] for k in range(n)),default=INF)+x+T t2 = INF dp[n] = min(t1,t2) answer = dp[N] + (E-X[-1]) print(answer) if N >= 10**4: raise Exception base_solution()
s096041712
p03940
u102461423
1571706035
Python
Python (3.4.3)
py
Runtime Error
474
13032
861
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from bisect import bisect_left N,E,T = map(int,readline().split()) X = [0] + list(map(int,read().split())) X2 = [2*x for x in X] INF = 10**18 def base_solution(): # これをseg木に乗せまーす dp = [0] * (N+1) for n in range(1,N+1): x = X[n] i = bisect_left(X2,2*x-T) # i-1番目まで戻る → 待ち時間なし # i番目まで戻る → 待ち時間発生 if i >= 1: t1 = min((dp[k]-X[k] for k in range(i-1,n)),default=INF)+x+T else: t1 = INF t2 = min((dp[k]-X[k]-2*X[k+1] for k in range(i-1)),default=INF)+3*x dp[n] = min(t1,t2) answer = dp[N] + (E-X[-1]) print(answer) if N >= 10**4: raise Exception base_solution()
s864710114
p03940
u247366051
1553980498
Python
Python (3.4.3)
py
Runtime Error
17
2940
105
#include<bits/stdc++.h> using namespace std; int n,k,e; int main() { cin>>n>>k>>e; cout<<k+n*e<<endl; }
s424658836
p03940
u226155577
1479009672
Python
PyPy2 (5.6.0)
py
Runtime Error
167
50972
441
n, e, t = map(int, raw_input().split()) X = map(int, raw_input().split()) if n > 2001: exit(1) ans = 0 bef = 0 bef_i = 0 d = [[0 for i in xrange(n)] for j in xrange(n)] for i in xrange(n): el = d[i] xi = X[i] for j in xrange(i, n): el[j] = max(2*(X[j] - xi), t) + X[j] - xi for i in xrange(n): for j in xrange(i): d[0][i] = min(d[0][j]+d[j+1][i]+(X[j+1]-X[j]), d[0][i]) print d[0][n-1]+ e - X[-1] + X[0]
s947241916
p03943
u755930923
1601311503
Python
Python (3.8.2)
py
Runtime Error
28
8808
119
if a + b = c: print('Yes') elif a + c = b: print('Yes') elif b + c = a: print('Yes') else: print('No')
s085916360
p03943
u375065632
1601235117
Python
Python (3.8.2)
py
Runtime Error
26
8956
67
x,y,z =sorted(map(int,input().split())) print("Yes" if x+y==z "No")
s921113505
p03943
u521323621
1601168297
Python
Python (3.8.2)
py
Runtime Error
25
8968
91
a,b,c = map(int, input().split()) if (a+b+c) % 3 == 0:P print("Yes") else: print("No")
s420380613
p03943
u382639013
1600989943
Python
Python (3.8.2)
py
Runtime Error
25
8972
120
a, b, c = map(int, input().split()) if ((a+b)==c) or ((b+c)==a ) or ((c+a)==b): print("Yes") else: print("No")
s641166798
p03943
u382639013
1600989855
Python
Python (3.8.2)
py
Runtime Error
24
8788
113
a, b, c = map(int, input().split()) if (a+b)==c or (b+c)==a or (c+a)==b: print("Yes") else: print("No")
s858314110
p03943
u097700948
1600919347
Python
Python (3.8.2)
py
Runtime Error
24
9108
410
W, H, N = map(int, input().split()) xy = [0, W, 0, H] judge = True for n in range(N): x, y, a = map(int, input().split()) a -= 1 if a<=1 and judge: xy[a] = x if xy[0] >= xy[1]: judge = False else: xy[a] = y if xy[2] >= xy[3]: judge = False print(xy) area = (xy[1] - xy[0]) * (xy[3] - xy[2]) if not judge: area = 0 print(area)
s965131203
p03943
u944396627
1600539372
Python
Python (3.8.2)
py
Runtime Error
24
9020
254
import sys sys.setrecursionlimit(250000) def main(): a,b,c = map(int, input().split()) if a == b + c : print("Yes") elif b == a + c: print("Yes") elif c == a + b: print("Yes") else print("No") main()
s619259215
p03943
u620846115
1600435147
Python
Python (3.8.2)
py
Runtime Error
21
8916
102
x = list(map(int,input().split())) y = sorted(x) if y[0]+y[1]=y[2]: print("Yes") else: print("No")
s559354004
p03943
u014139588
1600129926
Python
Python (3.8.2)
py
Runtime Error
28
8840
93
a, b, c = map(int,input().split()) if a+b=c or b+c=a or c+a=b: print(Yes) else: print(No)
s802620834
p03943
u886902015
1599860209
Python
Python (3.8.2)
py
Runtime Error
26
9020
97
a,b,c=map(int,input().split()) if a+b=c or a+c=b or b+c=a: print("Yes") else: print("No")
s822759744
p03943
u886902015
1599859728
Python
Python (3.8.2)
py
Runtime Error
22
8888
88
a,b,c=input().split() if a+b=c or a+c=b or b+c=a: print("Yes") else: print("No")
s700271227
p03943
u074220993
1599168142
Python
Python (3.8.2)
py
Runtime Error
32
9140
88
L = sorted(list(map(int, input().split()))) print('Yes' if sum(L[:2] == L[2]) else 'No')
s403139727
p03943
u278143034
1599148237
Python
Python (3.8.2)
py
Runtime Error
28
8940
202
# キャンディの個数を取得 a,b,c = map(int, input().split()) #判定結果をもとにメッセージを出力 if a == b + c\ or b == a + c\ or c == a + b: print("Yes") else: print("No")
s124699189
p03943
u546132222
1599103747
Python
Python (3.8.2)
py
Runtime Error
21
9044
316
# 3個のパックにそれぞれ、a,b,c個のキャンディーが入っている # キャンディーを2人に分ける際、個数が等しくなるか判定 # 入力 a = int(input()) b = int(input()) c = int(input()) # 処理 if a == b + c or b == a + c or c == a + b: print("Yes") else: print("No")
s418715439
p03943
u980753441
1599004859
Python
Python (3.8.2)
py
Runtime Error
21
9028
84
p = list(map(int, input().split())).sort() print('Yes' if p[0]+p[1]==p[2] else 'No')
s027860487
p03943
u672316981
1598723440
Python
Python (3.8.2)
py
Runtime Error
25
9100
111
abc = map(int, input().split()) abc.sort() if abc[0] + abc[1] == abc[2]: print('Yes') else: print('No')
s014427229
p03943
u434630332
1598629447
Python
Python (3.8.2)
py
Runtime Error
24
9120
129
a = int(input()) b = int(input()) c = int(input()) if a == b + c or b == a + c or c == a + b: print("Yes") else: print("No")
s857191173
p03943
u771405286
1598414089
Python
Python (3.8.2)
py
Runtime Error
25
8948
441
#prepare L = [] Q = [] #input W, H, N, = map(int,raw_input().split()) for i in range(N): L.append(map(int,raw_input().split())) x1=0 x2=W y1=0 y2=H #calculate Q = [row[2] for row in L] for k in range(N): if Q[k] == 1: x1 = max(x1,L[k][0]) elif Q[k] == 2: x2 = min(x2,L[k][0]) elif Q[k] == 3: y1 = max(y1,L[k][1]) elif Q[k] == 4: y2 = min(y2,L[k][1]) print(max(0,x2-x1) * max(0,y2-y1)0
s786905301
p03943
u771405286
1598413720
Python
Python (3.8.2)
py
Runtime Error
24
9160
581
W, H, N = map(int, input().split()) array = [list(map(int, input().split())) for i in range(N)] xmin = 0 xmax = W ymin = 0 ymax = H for i in range(N): if array[i][2] == 1: if array[i][0] > xmin: xmin = array[i][0] if array[i][2] == 2: if array[i][0] < xmax: xmax = array[i][0] if array[i][2] == 3: if array[i][1] > ymin: ymin = array[i][1] if array[i][2] == 4: if array[i][1] < ymax: ymax = array[i][1] area = (xmax-xmin)*(ymax-ymin) if area <= 0: print(0) else: print(area)
s521220495
p03943
u546853743
1598368737
Python
Python (3.8.2)
py
Runtime Error
32
9040
173
a=input() b=input() c=input() if a+b == c: print('Yes') elif a+c == b: print('Yes') elif b+c == a: print('Yes') else: print('No')
s905097403
p03943
u869790980
1598337371
Python
PyPy2 (7.3.0)
py
Runtime Error
361
84920
91
ais = sorted(map(int, raw_input()).split()) print 'Yes' if sum(ais[:2]) == ais[2] else 'No'
s647402554
p03943
u869790980
1598337351
Python
PyPy2 (7.3.0)
py
Runtime Error
398
84912
83
ais = sorted(map(int, raw_input())) print 'Yes' if sum(ais[:2]) == ais[2] else 'No'
s586433035
p03943
u077671688
1598320012
Python
Python (3.8.2)
py
Runtime Error
27
8984
100
if ( a + b == c ) or ( a + c == b ) or ( b + c == a ) : print ( "Yes" ) else: print ( "No" )
s577624786
p03943
u955248595
1598045507
Python
Python (3.8.2)
py
Runtime Error
25
8968
96
a,b,c = (int(T) for T in input().split()) print(['No','Yes'][(a+ab)==c or (b+c)==a or (c+a)==b])
s891046467
p03943
u612635771
1597786589
Python
Python (3.8.2)
py
Runtime Error
22
9092
103
a = list(map(int, input().split())) b = a.sort() print(b) print("Yes" if b[0]+b[1] == b[2] else "No")
s074957590
p03943
u468972478
1597521710
Python
Python (3.8.2)
py
Runtime Error
24
8980
111
lst = list(map(int, input().split)) lst.sort() if lst[0] + lst[1] == lst[2]: print("YES") else: print("NO")
s995230263
p03943
u468972478
1597521641
Python
Python (3.8.2)
py
Runtime Error
26
8896
108
lst = sorted(list(map(int, input().split))) if lst[0] + lst[1] == lst[2]: print("YES") else: print("NO")
s989399919
p03943
u468972478
1597521098
Python
Python (3.8.2)
py
Runtime Error
24
9008
162
nums = list(map(int, input().split())) ans = 0 for i in nums: if i == sum(nums.remove(i)): ans += 1 break if ans > 0: print("YES") else: print("NO")
s135640362
p03943
u552738814
1596845728
Python
Python (3.8.2)
py
Runtime Error
21
8948
106
a,b,c = map(int,input().split()) if a+b = c or a+c = b or b+c = a: print("Yes") else: print("No")
s575172486
p03943
u226779434
1596712875
Python
Python (3.8.2)
py
Runtime Error
24
8928
142
a,b,c = int(input.split()) if a + b == c: print("Yes") elif a + c == b: print("Yes") elif b + c ==a: print("Yes") else: print("No")
s246869667
p03943
u714104087
1596574264
Python
PyPy3 (7.3.0)
py
Runtime Error
94
74768
78
a, b, c = sorted(map(int.input().split())) print("YES" if a+b == c else "No")