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
s704836804
p00481
u940190657
1433661599
Python
Python3
py
Runtime Error
19930
18644
1396
import queue # directions x_dir = [0, 1, 0, -1] y_dir = [1, 0, -1, 0] # initialization visited maps def init_visited_maps(h, w): return [[True for i in range(w)] for j in range(h)] # bfs algorithm def bfs(h, w, cheese, maps, sx, sy, moves): que = queue.Queue() que.put((moves, sx, sy)) visited = in...
s207319350
p00481
u940190657
1433662020
Python
Python3
py
Runtime Error
19920
18648
1404
import queue # directions x_dir = [0, 1, 0, -1] y_dir = [1, 0, -1, 0] # bfs algorithm def bfs(h, w, cheese, maps, sx, sy, moves, visited): que = queue.Queue() que.put((moves, sx, sy)) for i in range(h): for j in range(w): visited[i][j] = True visited[sy][sx] = False while ...
s226872146
p00481
u940190657
1433663434
Python
Python3
py
Runtime Error
19920
19492
1438
import queue # directions x_dir = [0, 1, 0, -1] y_dir = [1, 0, -1, 0] visited = [[True for i in range(1000)] for j in range(1000)] maps = [] # bfs algorithm def bfs(h, w, cheese, sx, sy, moves): que = queue.Queue() que.put((moves, sx, sy)) for i in range(h): for j in range(w): visi...
s279781729
p00481
u940190657
1433664782
Python
Python3
py
Runtime Error
19920
18612
1280
import queue # directions x_dir = [0, 1, 0, -1] y_dir = [1, 0, -1, 0] # map info visited = [] maps = [] # bfs algorithm def bfs(h, w, cheese, sx, sy, moves): que = queue.Queue() que.put((moves, sx, sy)) for i in range(h): for j in range(w): visited[i][j] = (maps[i][j] != 'X') v...
s945219944
p00481
u940190657
1434379919
Python
Python3
py
Runtime Error
0
0
1228
# directions x_dir = [0, 1, 0, -1] y_dir = [1, 0, -1, 0] # map info visited = [] maps = [] # bfs algorithm def bfs(h, w, cheese, sx, sy, moves): que = [(moves, sx, sy)] for i in range(h): for j in range(w): visited[i][j] = (maps[i][j] != 'X') visited[sy][sx] = False while len(qu...
s069891944
p00481
u421925564
1461728425
Python
Python3
py
Runtime Error
40000
47972
1422
import copy h = w = 0 mymap =[] const_mymap = [] qlist = [] ans = 0 def bfs(n): while True: if len(qlist) != 0: temp = qlist.pop(0) x = temp[0] y = temp[1] deep = temp[2] #print(temp) if mymap[y][x] == str(n): return ...
s529528600
p00481
u884495090
1461826976
Python
Python
py
Runtime Error
40000
38828
849
#!/usr/bin/env python vector = [[1,0],[-1,0],[0,1],[0,-1]] matrix = [] visited = [] q = [] h,w,n = map(int,raw_input().split()) s_x = 0 s_y = 0 for i in xrange(h): matrix.append( list(raw_input())) visited.append([0]*w) if 'S' in matrix[i]: s_y = i s_x = matrix[i].index('S') ans = 0 for t in xrange(n)...
s856809203
p00481
u577311000
1493719860
Python
Python3
py
Runtime Error
40000
7800
1342
# -*- coding: utf-8 -*- import sys sys.setrecursionlimit(10**7) def search(field,distance,ch,cv,eh,ev,step): if not (0<=ch<len(field)): return if not (0<=cv<len(field[ch])): return if field[ch][cv]=='X': return if distance[ch][cv]<step: return distance[ch][cv] = step search(field,distance,ch+1,cv,eh,ev,st...
s208116348
p00481
u577311000
1493723004
Python
Python3
py
Runtime Error
0
0
1355
# -*- coding: utf-8 -*- def get_shortest_distance(field,locations,current_HP): is_visit = [[False for _ in range(len(field[0]))] for __ in range(len(field))] frontier = set() frontier.add(locations[current_HP-1]) for step in xrange(10**10): for cx,cy in frontier: if (cx,cy)==locations[current_HP]: return step...
s336608824
p00481
u940389926
1493742517
Python
Python3
py
Runtime Error
0
0
3212
import sys import numpy sys.setrecursionlimit(1000000) class MouseClass: def __init__(self): self.X = 0 self.Y = 0 self.LIFE = 1 self.factoriesAble = [] self.factoriesGone = [] self.factoriesWill = [] self.distance = 0 def get_field(self, field:list): self.field = field def gen_factoriesInfo(self,...
s007533167
p00481
u945345165
1494905257
Python
Python3
py
Runtime Error
40000
69400
1001
def bfs(count, x, y, cheese): queue = [(count,x,y)] while len(queue)>0: tempc,tempx,tempy = queue.pop(0) if geo[tempx][tempy] == cheese: return tempc,tempx,tempy for i in range(4): neox = tempx+dx[i] neoy = tempy+dy[i] if canGoTo(neox,neoy)...
s450836795
p00481
u945345165
1494927972
Python
Python3
py
Runtime Error
40000
7896
1058
def bfs(count, x, y, cheese): queue = [(count,x,y)] while len(queue)>0: tempc,tempx,tempy = queue.pop(0) if geo[tempx][tempy] == cheese: return tempc,tempx,tempy for i in range(4): neox = tempx+dx[i] neoy = tempy+dy[i] if canGoTo(neox,neoy)...
s041011298
p00481
u028939600
1495362775
Python
Python3
py
Runtime Error
0
0
2389
import sys sys.setrecursionlimit(100000000) def getStart(field): # before this, cut the first [H,W,N] search_field = field[1:] for i in range(len(search_field)): for j in range(len(search_field[0])): if search_field[i][j] == "S": print("start point ({},{})".format(i+1,j...
s608561953
p00481
u028939600
1495377707
Python
Python3
py
Runtime Error
0
0
2047
def getField(): matrix = [] while True: row = input().split() if len(row) == 1: re_row = [] for char in row[0]: if char.isdigit(): re_row.append(int(char)) else: re_row.append(char) matrix...
s897980623
p00481
u028939600
1495378199
Python
Python3
py
Runtime Error
0
0
1941
def getStart(field): search_field = field[1:] # cut the first [H,W,N] for min_path matrix for y in range(len(search_field)): for x in range(len(search_field[0])): if search_field[y][x] == "S": return x,y+1 def bfs(field,start_x,start_y,goal_N): direction = [[-1,0],...
s639789445
p00481
u028939600
1495378389
Python
Python3
py
Runtime Error
0
0
2486
import sys sys.setrecursionlimit(100000000) def getStart(field): search_field = field[1:] # cut the first [H,W,N] for min_path matrix for y in range(len(search_field)): for x in range(len(search_field[0])): if search_field[y][x] == "S": return x,y+1 def bfs(field,star...
s396944705
p00481
u028939600
1495379029
Python
Python3
py
Runtime Error
0
0
2412
def getStart(field): search_field = field[1:] # cut the first [H,W,N] for min_path matrix for y in range(len(search_field)): for x in range(len(search_field[0])): if search_field[y][x] == "S": return x,y+1 def bfs(field,start_x,start_y,goal_N): direction = [[-1,0],...
s155197109
p00481
u028939600
1495379096
Python
Python3
py
Runtime Error
0
0
2418
def getStart(field): search_field = field[1:] # cut the first [H,W,N] for min_path matrix for y in range(len(search_field)): for x in range(len(search_field[0])): if search_field[y][x] == "S": return x,y+1 def bfs(field,start_x,start_y,goal_N): direction = [[-1,0],...
s607279528
p00481
u028939600
1495379261
Python
Python3
py
Runtime Error
0
0
2427
def getStart(field): search_field = field[1:] # cut the first [H,W,N] for min_path matrix for y in range(len(search_field)): for x in range(len(search_field[0])): if search_field[y][x] == "S": return x,y+1 def bfs(field,start_x,start_y,goal_N): direction = [[-1,0],...
s373074667
p00481
u028939600
1495379902
Python
Python3
py
Runtime Error
0
0
1662
import sys sys.setrecursionlimit(100000000) moves = [(0, -1), (0, 1), (-1, 0), (1, 0)] def search(dataset): min_time = 0 mouse = 1 gx, gy = get_start(dataset) for i in xrange(N): gx, gy, min_time_tmp = bfs(dataset, (gx, gy), mouse) mouse += 1 min_time += min_time_tmp pr...
s561358968
p00481
u028939600
1495385789
Python
Python3
py
Runtime Error
0
0
1672
def getStart(field): search_field = field[1:] for y in range(len(search_field)): for x in range(len(search_field[0])): if search_field[y][x] == "S": return x,y+1 def bfs(field,start_x,start_y,goal_N): direction = [[-1,0],[1,0],[0,-1],[0,1]] gotten_cheese = 1 d...
s422169442
p00481
u028939600
1495385902
Python
Python3
py
Runtime Error
0
0
1689
def getStart(field): search_field = field[1:] for y in range(len(search_field)): for x in range(len(search_field[0])): if search_field[y][x] == "S": return x,y+1 def bfs(field,start_x,start_y,goal_N): direction = [[-1,0],[1,0],[0,-1],[0,1]] gotten_cheese = 1 d...
s794314891
p00481
u028939600
1495385952
Python
Python3
py
Runtime Error
0
0
1698
def getStart(field): search_field = field[1:] for y in range(len(search_field)): for x in range(len(search_field[0])): if search_field[y][x] == "S": return x,y+1 def bfs(field,start_x,start_y,goal_N): direction = [[-1,0],[1,0],[0,-1],[0,1]] gotten_cheese = 1 d...
s848212421
p00481
u028939600
1495386065
Python
Python3
py
Runtime Error
0
0
1707
def getStart(field): search_field = field[1:] for y in range(len(search_field)): for x in range(len(search_field[0])): if search_field[y][x] == "S": return x,y+1 def bfs(field,start_x,start_y,goal_N): direction = [[-1,0],[1,0],[0,-1],[0,1]] gotten_cheese = 1 d...
s143027214
p00481
u028939600
1495386130
Python
Python3
py
Runtime Error
0
0
1694
def getStart(field): search_field = field[1:] for y in range(len(search_field)): for x in range(len(search_field[0])): if search_field[y][x] == "S": return x,y+1 def bfs(field,start_x,start_y,goal_N): direction = [[-1,0],[1,0],[0,-1],[0,1]] gotten_cheese = 1 d...
s655580596
p00481
u028939600
1495386679
Python
Python3
py
Runtime Error
0
0
1693
def getStart(field): search_field = field[1:] for y in range(len(search_field)): for x in range(len(search_field[0])): if search_field[y][x] == "S": return x,y+1 def bfs(field,start_x,start_y,goal_N): direction = [[-1,0],[1,0],[0,-1],[0,1]] gotten_cheese = 1 d...
s261745845
p00481
u028939600
1495386969
Python
Python3
py
Runtime Error
0
0
1695
def getStart(field): search_field = field[1:] for y in range(len(search_field)): for x in range(len(search_field[0])): if search_field[y][x] == "S": return x,y+1 def bfs(field,start_x,start_y,goal_N): direction = [[-1,0],[1,0],[0,-1],[0,1]] gotten_cheese = 1 d...
s043942970
p00481
u028939600
1495387025
Python
Python3
py
Runtime Error
0
0
2791
def getStart(field): search_field = field[1:] # cut the first [H,W,N] for min_path matrix for y in range(len(search_field)): for x in range(len(search_field[0])): if search_field[y][x] == "S": return x,y+1 def bfs(field,start_x,start_y,goal_N): direction = [[-1,0],...
s287158648
p00481
u028939600
1495426084
Python
Python3
py
Runtime Error
0
0
2650
def getStart(field): search_field = field[1:] # cut the first [H,W,N] for min_path matrix for y in range(len(search_field)): for x in range(len(search_field[0])): if search_field[y][x] == "S": return x,y+1 def bfs(field,start_x,start_y,goal_N): direction = [[-1,0],...
s734329953
p00481
u028939600
1495429033
Python
Python3
py
Runtime Error
30
8052
2598
from collections import deque def getStart(field): search_field = field[1:] # cut the first [H,W,N] for min_path matrix for y in range(len(search_field)): for x in range(len(search_field[0])): if search_field[y][x] == "S": return x,y+1 def bfs(field,start_x,start_y,goa...
s828713832
p00481
u028939600
1495436212
Python
Python3
py
Runtime Error
0
0
1754
def bfs(field,start_x,start_y,tmp_N): direction = [[-1,0],[1,0],[0,-1],[0,1]] que = [] que.append([start_x,start_y]) INF = 1000000 min_path = [[INF] * field[0][1] for i in range(field[0][0])] min_path[start_y][start_x] = 0 while len(que) != 0: current = que.pop(0) for d in d...
s620733962
p00481
u028939600
1495437196
Python
Python3
py
Runtime Error
0
0
1609
moves = [(0, -1), (0, 1), (-1, 0), (1, 0)] def search(dataset): min_time = 0 mouse = 1 gx, gy = get_start(dataset) for i in xrange(N): gx, gy, min_time_tmp = bfs(dataset, (gx, gy), mouse) mouse += 1 min_time += min_time_tmp print(min_time) def bfs(dataset, start, mous...
s687817971
p00481
u028939600
1495437895
Python
Python3
py
Runtime Error
0
0
1563
def bfs(field,H,W,start_x,start_y,tmp_N): direction = [[-1,0],[1,0],[0,-1],[0,1]] que = [] que.append([start_x,start_y]) INF = 1000000 min_path = [[INF] * W for i in range(H)] min_path[start_y][start_x] = 0 while len(que) != 0: current = que.pop(0) for d in direction: ...
s295165093
p00481
u198881450
1495438126
Python
Python3
py
Runtime Error
0
0
1563
def bfs(field,H,W,start_x,start_y,tmp_N): direction = [[-1,0],[1,0],[0,-1],[0,1]] que = [] que.append([start_x,start_y]) INF = 1000000 min_path = [[INF] * W for i in range(H)] min_path[start_y][start_x] = 0 while len(que) != 0: current = que.pop(0) for d in direction: ...
s621955689
p00481
u198881450
1495438309
Python
Python
py
Runtime Error
0
0
1570
def bfs(field,H,W,start_x,start_y,tmp_N): direction = [[-1,0],[1,0],[0,-1],[0,1]] que = [] que.append([start_x,start_y]) INF = 1000000 min_path = [[INF] * W for i in xrange(H)] min_path[start_y][start_x] = 0 while len(que) != 0: current = que.pop(0) for d in direction: ...
s345091932
p00481
u198881450
1495438449
Python
Python
py
Runtime Error
0
0
1571
def bfs(field,H,W,start_x,start_y,tmp_N): direction = [[-1,0],[1,0],[0,-1],[0,1]] que = [] que.append([start_x,start_y]) INF = 1000000 min_path = [[INF] * W for i in xrange(H)] min_path[start_y][start_x] = 0 while len(que) != 0: current = que.pop(0) for d in direction: ...
s012309421
p00481
u198881450
1495438542
Python
Python
py
Runtime Error
0
0
1571
def bfs(field,H,W,start_x,start_y,tmp_N): direction = [[-1,0],[1,0],[0,-1],[0,1]] que = [] que.append([start_x,start_y]) INF = 1000000 min_path = [[INF] * W for i in xrange(H)] min_path[start_y][start_x] = 0 while len(que) != 0: current = que.pop(0) for d in direction: ...
s080984529
p00481
u198881450
1495438558
Python
Python
py
Runtime Error
0
0
1542
def bfs(field,H,W,start_x,start_y,tmp_N): direction = [[-1,0],[1,0],[0,-1],[0,1]] que = [] que.append([start_x,start_y]) INF = 1000000 min_path = [[INF] * W for i in xrange(H)] min_path[start_y][start_x] = 0 while len(que) != 0: current = que.pop(0) for d in direction: ...
s105604092
p00481
u695154284
1505318719
Python
Python3
py
Runtime Error
0
0
1210
from collections import deque d = [(1, 0), (-1, 0), (0, 1), (0, -1)] def bfs(n): global pos_x, pos_y while len(que) != 0: x, y = que.popleft() for dx, dy in d: if 0 <= x + dx < W and 0 <= y + dy < H: if meiz[x + dx][y + dy] == str(n): pos_x = x ...
s432873299
p00481
u072053884
1517476399
Python
Python3
py
Runtime Error
30
6008
2125
import sys file_input = sys.stdin H, W, N = map(int, file_input.readline().split()) town_map = file_input.read() start_index = town_map.index('S') mouse = [start_index, 0, [start_index]] # position, elapsed time, visited lot from collections import deque for goal in range(1, N + 1): q = deque() goal = st...
s609816599
p00481
u766926358
1525857000
Python
Python3
py
Runtime Error
30
6012
1009
from collections import deque import sys sys.setrecursionlimit(10000) H, W, N = map(int, input().split()) field = [list(input()) for i in range(H)] us = [str(i) for i in range(N, 0, -1)] queue = deque([]) dx = [1,0,-1,0] dy = [0,1,0,-1] def search(posi): global flag global us global count global queue x, y, c =...
s788381983
p00481
u766926358
1525858381
Python
Python3
py
Runtime Error
30
6012
899
from collections import deque import sys sys.setrecursionlimit(10000) H, W, N = map(int, input().split()) field = [list(input()) for i in range(H)] us = [str(i) for i in range(N, 0, -1)] queue = deque([]) dx = [1,0,-1,0] dy = [0,1,0,-1] def search(): global flag global us global count global queue x, y, c = que...
s678880456
p00481
u766926358
1525858590
Python
Python3
py
Runtime Error
30
6012
890
from collections import deque H, W, N = map(int, input().split()) field = [list(input()) for i in range(H)] us = [str(i) for i in range(N, 0, -1)] queue = deque([]) dx = [1,0,-1,0] dy = [0,1,0,-1] def search(): global flag global us global count global queue while queue: x, y, c = queue.popleft() if (fie...
s773936454
p00481
u766926358
1525864102
Python
Python3
py
Runtime Error
1430
18712
806
from collections import deque H, W, N = map(int, input().split()) field = [list(input()) for i in range(H)] node_posi = {} Q = deque() def search(start, goal): Q.append(start) while Q: x, y, c = Q.popleft() searched[y][x] = 1 if ([x, y, 0] == goal): return c for q in range(4): nx = x + [1,0,-1,0...
s645155206
p00481
u766926358
1525864299
Python
Python3
py
Runtime Error
1570
18712
779
from collections import deque H, W, N = map(int, input().split()) field = [list(input()) for i in range(H)] node_posi = {} Q = deque() def search(start, goal): Q.append(start) while Q: x, y, c = Q.popleft() searched[y][x] = 1 if ([x, y, 0] == goal): return c for q in range(4): nx = x + [1,0,-1,0...
s606138553
p00481
u352394527
1525936944
Python
Python3
py
Runtime Error
60
7172
1095
import queue h,w,n = map(int,input().split()) factrys = [None] * (n + 1) ss = ["X" * (w + 2)] for i in range(h): s = "X" + input() + "X" if "S" in s: factrys[0] = (i + 1,s.index("S")) for j in range(1,n + 1): if str(j) in s: factrys[j] = (i + 1,s.index(str(j))) ss.append(s) ss.append("X" * (w + 2)...
s100498812
p00481
u352394527
1525937057
Python
Python3
py
Runtime Error
140
10844
1138
import sys import queue sys.setrecursionlimit(10000000) h,w,n = map(int,input().split()) factrys = [None] * (n + 1) ss = ["X" * (w + 2)] for i in range(h): s = "X" + input() + "X" if "S" in s: factrys[0] = (i + 1,s.index("S")) for j in range(1,n + 1): if str(j) in s: factrys[j] = (i + 1,s.index(str(...
s495741969
p00481
u352394527
1525937774
Python
Python3
py
Runtime Error
140
6952
1129
import queue h,w,n = map(int,input().split()) factrys = [None] * (n + 1) ss = ["X" * (w + 2)] for i in range(h): s = "X" + input() + "X" if "S" in s: factrys[0] = (i + 1,s.index("S")) for j in range(1,n + 1): if str(j) in s: factrys[j] = (i + 1,s.index(str(j))) ss.append(s) ss.append("X" * (w + 2)...
s037771115
p00481
u352394527
1525941083
Python
Python3
py
Runtime Error
0
0
1499
import queue h,w,n = map(int,input().split()) factrys = [None] * (n + 1) ss = ["X" * (w + 2)] for i in range(h): s = "X" + input() + "X" if "S" in s: factrys[0] = (i + 1, s.index("S")) for j in range(1,n + 1): if str(j) in s: factrys[j] = (i + 1, s.index(str(j))) ss.append(s) ss.append("X" * (w + ...
s042477423
p00481
u352394527
1525941164
Python
Python3
py
Runtime Error
50
6856
1498
import queue h,w,n = map(int,input().split()) factrys = [None] * (n + 1) ss = ["X" * (w + 2)] for i in range(h): s = "X" + input() + "X" if "S" in s: factrys[0] = (i + 1, s.index("S")) for j in range(1,n + 1): if str(j) in s: factrys[j] = (i + 1, s.index(str(j))) ss.append(s) ss.append("X" * (w + ...
s806718734
p00481
u352394527
1525941354
Python
Python3
py
Runtime Error
140
6952
1498
import queue h,w,n = map(int,input().split()) factrys = [None] * (n + 1) ss = ["X" * (w + 2)] for i in range(h): s = "X" + input() + "X" if "S" in s: factrys[0] = (i + 1, s.index("S")) for j in range(1,n + 1): if str(j) in s: factrys[j] = (i + 1, s.index(str(j))) ss.append(s) ss.append("X" * (w + ...
s302069088
p00481
u352394527
1525942887
Python
Python3
py
Runtime Error
0
0
1189
import queue h,w,n = map(int,input().split()) factrys = [None] * (n + 1) ss = ["X" * (w + 2)] for i in range(h): s = "X" + input() + "X" if "S" in s: factrys[0] = (i + 1, s.index("S")) for j in range(1,n + 1): if str(j) in s: factrys[j] = (i + 1, s.index(str(j))) ss.append(s) ss.append("X" * (w + ...
s576183556
p00481
u352394527
1525943016
Python
Python3
py
Runtime Error
160
6948
1186
import queue h,w,n = map(int,input().split()) factrys = [None] * (n + 1) ss = ["X" * (w + 2)] for i in range(h): s = "X" + input() + "X" if "S" in s: factrys[0] = (i + 1, s.index("S")) for j in range(1,n + 1): if str(j) in s: factrys[j] = (i + 1, s.index(str(j))) ss.append(s) ss.append("X" * (w + ...
s499563284
p00481
u352394527
1525943502
Python
Python3
py
Runtime Error
130
6900
1189
import queue from collections import deque h,w,n = map(int,input().split()) factrys = [None] * (n + 1) ss = ["X" * (w + 2)] for i in range(h): s = "X" + input() + "X" if "S" in s: factrys[0] = (i + 1, s.index("S")) for j in range(1,n + 1): if str(j) in s: factrys[j] = (i + 1, s.index(str(j))) ss.a...
s896918749
p00481
u766926358
1525968760
Python
Python3
py
Runtime Error
0
0
1297
h,w,n = map(int, input().split()) stage = [input() for i in range(h)] starts = [str(i) for i in range(n)] goals = [str(i+1) for i in range(n)] starts_y = [0 for i in range(n)] starts_x = [0 for i in range(n)] goals_y = [0 for i in range(n)] goals_x = [0 for i in range(n)] starts[0] = "S" for y in range(h): for x in r...
s961259576
p00481
u766926358
1525968806
Python
Python3
py
Runtime Error
0
0
1297
h,w,n = map(int, input().split()) stage = [input() for i in range(h)] starts = [str(i) for i in range(n)] goals = [str(i+1) for i in range(n)] starts_y = [0 for i in range(n)] starts_x = [0 for i in range(n)] goals_y = [0 for i in range(n)] goals_x = [0 for i in range(n)] starts[0] = "S" for y in range(h): for x in r...
s251392599
p00481
u766926358
1525969022
Python
Python3
py
Runtime Error
0
0
1313
h,w,n = map(int, input().split()) stage = [input() for i in range(h)] starts = [str(i) for i in range(n)] goals = [str(i+1) for i in range(n)] starts_y = [0 for i in range(n)] starts_x = [0 for i in range(n)] goals_y = [0 for i in range(n)] goals_x = [0 for i in range(n)] starts[0] = "S" for y in range(h): for x in r...
s393386398
p00481
u766926358
1525970567
Python
Python3
py
Runtime Error
1590
18712
779
from collections import deque H, W, N = map(int, input().split()) field = [list(input()) for i in range(H)] node_posi = {} Q = deque() def search(start, goal): Q.append(start) while Q: x, y, c = Q.popleft() searched[y][x] = 1 if ([x, y, 0] == goal): return c for q in range(4): nx = x + [1,0,-1,0...
s911736805
p00481
u766926358
1525970800
Python
Python3
py
Runtime Error
5360
18360
740
H, W, N = map(int, input().split()) field = [list(input()) for i in range(H)] node_posi = {} Q = [] def search(start, goal): Q.append(start) while Q: x, y, c = Q.pop(0) searched[y][x] = 1 if ([x, y, 0] == goal): return c for q in range(4): nx = x + [1,0,-1,0][q] ny = y + [0,1,0,-1][q] if (n...
s868628418
p00481
u766926358
1525971119
Python
Python3
py
Runtime Error
5990
18364
719
H, W, N = map(int, input().split()) field = [list(input()) for i in range(H)] node_posi = {} Q = [] for i in range(H): for j in range(W): if field[i][j] in 'S123456789': node_posi[field[i][j]] = [j, i, 0] s = 'S123456789' cost = 0 for i in range(len(node_posi)-1): Q.clear() searched = [[0]*W for i in range(H)...
s212897917
p00481
u531592024
1529421214
Python
Python3
py
Runtime Error
30
6344
1300
import copy (h, w, n) = list(map(int, input().split())) dis = [[] for i in range(n + 1)] def setArr(ph): global dis res = [False for i in range(w + 2)] for i, x in enumerate(list(input())): if x == "X": continue res[i + 1] = True if x == ".": continue ...
s737171396
p00481
u011621222
1530087212
Python
Python3
py
Runtime Error
190
7176
1095
from queue import Queue from collections import defaultdict try: d = [[1, 0], [-1, 0], [0, 1], [0, -1]] H, W, N = map(int, input().split()) G = [] sx = sy = 0 for i in range(H): G.append(input()) for j, c in enumerate(G[i]): if c == 'S': sx,...
s727593766
p00481
u011621222
1530088257
Python
Python3
py
Runtime Error
200
7164
1212
from queue import Queue from collections import defaultdict try: d = [[1, 0], [-1, 0], [0, 1], [0, -1]] H, W, N = map(int, input().split()) G = [] sx = sy = 0 for i in range(H): G.append(input()) for j, c in enumerate(G[i]): if c == 'S': sx, sy = i, j ...
s393832534
p00481
u260980560
1382805533
Python
Python
py
Runtime Error
0
0
996
from queue import Queue INF = 20000000 q = Queue() dx = [-1, 0, 1, 0] dy = [0, -1, 0, 1] smp = [[INF for i in range(1002)] for j in range(1002)] mp = [['X' for i in range(1002)] for j in range(1002)] ipt = input().split('\n') H, W, n = map(int,ipt[0].split()) for i in range(1, H+1): for j in range(1, W+1): ...
s568703582
p00481
u260980560
1382805714
Python
Python
py
Runtime Error
0
0
1000
from Queue import Queue INF = 20000000 q = Queue() dx = [-1, 0, 1, 0] dy = [0, -1, 0, 1] smp = [[INF for i in range(1002)] for j in range(1002)] mp = [['X' for i in range(1002)] for j in range(1002)] ipt = raw_input().split('\n') H, W, n = map(int,ipt[0].split()) for i in range(1, H+1): for j in range(1, W+1): ...
s347495805
p00482
u150984829
1526567784
Python
Python3
py
Runtime Error
60
5600
623
M, N = map(int, input().split()) cloth = sum([[*input()]for _ in[0] * M], []) ans = 3**cloth.count('?') def have_JOI(cloth): for i, p in enumerate(cloth[:-N]): if p == 'J' and cloth[i + 1] == 'O' and cloth[i + N] == 'I': return True return False def search(cloth): if have_JOI(cloth):...
s890935664
p00482
u150984829
1526568201
Python
Python3
py
Runtime Error
70
5596
646
M, N = map(int, input().split()) cloth = sum([[*input()]for _ in[0] * M], []) ans = 3 ** cloth.count('?') def have_JOI(cloth): for i, p in enumerate(cloth[:-N]): if i % N != N-1 and p == 'J' and cloth[i + 1] == 'O' and cloth[i + N] == 'I': return True return False def search(cloth): if h...
s146815062
p00482
u150984829
1526568372
Python
Python3
py
Runtime Error
70
5596
743
M, N = map(int, input().split()) cloth = sum([[*input()]for _ in[0] * M], []) ans = 3 ** cloth.count('?') def have_JOI(cloth): for i, p in enumerate(cloth[:-N]): if i % N != N-1 and p == 'J' and cloth[i + 1] == 'O' and cloth[i + N] == 'I': return True return False def search(cloth): if '...
s322382938
p00483
u633068244
1416591208
Python
Python
py
Runtime Error
19930
6168
325
M,N = map(int,raw_input().split()) K = int(raw_input()) A = [raw_input() for i in range(M)] for roop in range(K): a,b,c,d = map(int,raw_input().split()) j = o = i = 0 for m in range(a-1,c): j += A[m][b-1:d].count("J") o += A[m][b-1:d].count("O") i += A[m][b-1:d].count("I") print ...
s892196579
p00483
u633068244
1416592098
Python
Python
py
Runtime Error
19930
35572
650
M,N = map(int,raw_input().split()) K = int(raw_input()) A = [raw_input() for i in range(M)] J,O,I = [[0]*(N+1) for i in range(M)],[[0]*(N+1) for i in range(M)],[[0]*(N+1) for i in range(M)] for m in range(M): j = o = i = 0 for n in range(N): if A[m][n] == "J": j += 1 elif A[m][n] == "O": o += ...
s410031603
p00483
u633068244
1416592263
Python
Python
py
Runtime Error
19920
35576
696
M,N = map(int,raw_input().split()) K = int(raw_input()) A = [raw_input() for i in range(M)] J,O,I = [[0]*(N+1) for i in range(M)],[[0]*(N+1) for i in range(M)],[[0]*(N+1) for i in range(M)] for m in range(M): j = o = i = 0 for n in range(N): if A[m][n] == "J": j += 1 elif A[m][n] == "O": o += ...
s253638563
p00483
u186082958
1430035303
Python
Python3
py
Runtime Error
0
0
541
w=input() height=int(w[0]) wide=int(w[2]) pattern_num=int(input()) a=[] for i in range(pattern_num): a.append(input()) for i in range(pattern_num): y=input() north=int(y[0])-1; west=int(y[2])-1 south=int(y[4])-1; east=int(y[6])-1 jungle=0;ocean=0;ice=0; for j in range(north,south+1): ...
s725957125
p00483
u186082958
1430035398
Python
Python3
py
Runtime Error
0
0
554
w=input() height=int(w[0]) wide=int(w[2]) pattern_num=int(input()) a=[] for i in range(pattern_num): a.append(input()) for i in range(pattern_num): y=input() north=int(y[0])-1 west=int(y[2])-1 south=int(y[4])-1 east=int(y[6])-1 jungle=0 ocean=0 ice=0 for j in range(north,south...
s819415994
p00483
u186082958
1430035513
Python
Python3
py
Runtime Error
0
0
554
w=input() height=int(w[0]) wide=int(w[2]) pattern_num=int(input()) a=[] for i in range(pattern_num): a.append(input()) for i in range(pattern_num): y=input() north=int(y[0])-1 west=int(y[2])-1 south=int(y[4])-1 east=int(y[6])-1 jungle=0 ocean=0 ice=0 for j in range(north,south...
s822497270
p00483
u186082958
1430036103
Python
Python3
py
Runtime Error
0
0
642
w=input() height=int(w[0]) wide=int(w[2]) pattern_num=int(input()) a=[] for i in range(pattern_num): a.append(input()) for i in range(pattern_num): y=input() north=int(y[0])-1 west=int(y[2])-1 south=int(y[4])-1 east=int(y[6])-1 jungle=0 ocean=0 ice=0 for j in range(north,south...
s800889078
p00483
u186082958
1430036213
Python
Python3
py
Runtime Error
0
0
624
w=input() height=int(w[0]) wide=int(w[2]) pattern_num=int(input()) a=[] for i in range(pattern_num): a.append(input()) for i in range(pattern_num): y=input() north=int(y[0])-1 west=int(y[2])-1 south=int(y[4])-1 east=int(y[6])-1 jungle=0 ocean=0 ice=0 for j in range(north,south...
s866969345
p00483
u186082958
1430037107
Python
Python3
py
Runtime Error
0
0
554
line =input() w=line.split(" ") height=int(w[0]) wide=int(w[1]) pattern_num=int(input()) a=[] for i in range(pattern_num): a.append(input()) for i in range(pattern_num): y=input() north=int(y[0])-1 west=int(y[2])-1 south=int(y[4])-1 east=int(y[6])-1 jungle=0 ocean=0 ice=0 for ...
s959047668
p00483
u186082958
1430037227
Python
Python3
py
Runtime Error
0
0
587
line =input() w=line.split(" ") height=int(w[0]) wide=int(w[1]) pattern_num=int(input()) a=[] for i in range(pattern_num): a.append(input()) for i in range(pattern_num): aline =input() aw=aline.split(" ") north=int(aw[0])-1 west=int(aw[1])-1 south=int(aw[2])-1 east=int(aw[3])-1 jungle=...
s173196310
p00483
u186082958
1430037462
Python
Python3
py
Runtime Error
19920
6888
610
line =input() w=line.split(" ") height=int(w[0]) wide=int(w[1]) pattern_num=int(input()) a=[] for i in range(height): a.append(input()) for i in range(pattern_num): aline =input() aw=aline.split(" ") north=int(aw[0])-1 west=int(aw[1])-1 south=int(aw[2])-1 east=int(aw[3])-1 jungle=0 ...
s612748927
p00483
u228488524
1508219352
Python
Python3
py
Runtime Error
0
0
939
# coding: utf-8 M, N = list(map(int, input().split())) q = int(input()) Map = [] for i in range(M): Map.append(input) def get_slide_sum(Map, kw): l = [] for r in range(M): tmp = [] for c in range(N): ll = 0 if c == 0 else tmp[c-1] ul = 0 if r == 0 or c == 0 else l[r...
s901582256
p00483
u228488524
1508221591
Python
Python3
py
Runtime Error
0
0
958
# coding: utf-8 # Here your code ! M, N = list(map(int, input().split())) q = int(input()) Map = [] for i in range(M): Map.append(input) def get_slide_sum(Map, kw): l = [] for r in range(M): tmp = [] for c in range(N): ll = 0 if c == 0 else tmp[c-1] ul = 0 if r == 0...
s972016185
p00483
u829501316
1518280028
Python
Python3
py
Runtime Error
4700
11828
1096
M, N = map(int, input().split()) K = int(input()) P = ['_' * (N + 1) for _ in range(M + 1)] for mi in range(1, M + 1): P[mi] = '_' + input() # for p in P: # print('p', p) J = [[0 for _ in range(N + 1)] for _ in range(M + 1)] O = [[0 for _ in range(N + 1)] for _ in range(M + 1)] I = [[0 for _ in ran...
s419402601
p00483
u847467233
1530335684
Python
Python3
py
Runtime Error
430
32144
530
# AOJ 0560: Planetary Exploration # Python3 2018.6.30 bal4u tr = { 'J':0, 'O':1, 'I':2 } s = [[[0 for c in range(1002)] for r in range(1002)] for k in range(3)] m, n = map(int, input().split()) k = int(input()) for r in range(1, m+1): buf = input().strip() for c in range(1, n+1): for i in range(3): s[i][r][c] = s...
s590258743
p00483
u452764412
1377132525
Python
Python
py
Runtime Error
20000
13724
381
M, N = map(int, raw_input().split()) K = input() d = {} for i in range(M): a = raw_input() for j in range(N): d[i+1, j+1] = a[j] for _ in range(K): b = map(int, raw_input().split()) D = {} D['J'] = D['O'] = D['I'] = 0 for i in range(b[0], b[2]+1): for j in range(b[1], b[3]+1):...
s341275728
p00483
u872035937
1383261874
Python
Python
py
Runtime Error
39860
7780
574
sn_km, ew_km = map(int, raw_input().split()) seek_area = int(raw_input()) zone = sn_km*[ew_km*[0]] def cnt_zone(idx, first, last, str_for_count): return int(str(zone[idx])[first:last].count(str_for_count)) for i in range(sn_km): zone[i] = raw_input() for i in range(seek_area): J = O = I = 0 a, b,...
s285444654
p00483
u872035937
1383262016
Python
Python
py
Runtime Error
39860
7780
574
sn_km, ew_km = map(int, raw_input().split()) seek_area = int(raw_input()) zone = sn_km*[ew_km*[0]] def cnt_zone(idx, first, last, str_for_count): return int(str(zone[idx])[first:last].count(str_for_count)) for i in range(sn_km): zone[i] = raw_input() for i in range(seek_area): J = O = I = 0 a, b,...
s770683576
p00484
u797673668
1454129542
Python
Python3
py
Runtime Error
40000
8072
677
from collections import deque from itertools import chain, combinations n, k = map(int, input().split()) books = [[] for _ in range(10)] while n: c, g = map(int, input().split()) books[g - 1].append(c) n -= 1 for q in books: q.sort(reverse=True) done = set() max_cost = 0 for book_combi in combinati...
s959809106
p00484
u894114233
1475047026
Python
Python
py
Runtime Error
0
0
536
n,k=map(int,raw_input().split()) g=[[] for _ in xrange(10)] for i in xrange(n): v,j=map(int,raw_input().split()) g[j-1].append(v) for i in xrange(10): g[i].sort() g[i].reverse() books=[[0]*(k+1) for _ in xrange(10)] for i in xrange(10): for j in xrange(1,len(g[i])+1): books[i][j]=books[i][j...
s185922554
p00484
u197615397
1509891721
Python
Python3
py
Runtime Error
0
0
965
def solve(): N, K = map(int, input().split()) a = [[] for _ in [0]*10] l = [] for c, g in (tuple(map(int, input().split())) for _ in [0]*N): a[g-1].append(c) for i, prices in enumerate(a): ln = len(prices) if ln == 0: continue dp = [[-1]*(K+1) for _ in [0...
s513355749
p00484
u266872031
1521364134
Python
Python
py
Runtime Error
0
0
575
[N,K]=map(int, raw_input().split()) C=[[] for i in range(11)] D=[[0 for j in range(K+1)] for i in range(11)] M=[0 for i in range(11)] for i in range(N): c,g=map(int, raw_input().split()) C[g].append(c) M[g]+=1 for i in range(1,11): y=sorted(C[i], reverse=True) for j in range(len(y)): n = j+...
s977990382
p00486
u013637113
1526639254
Python
Python3
py
Runtime Error
0
0
1218
import numpy def cal_time(W, H, x, y): return 2*(abs(W-x) + abs(H-y)) geo = input("Input W H: ").split() W = int(geo[0]) H = int(geo[1]) if W<1 or W>1000000000: print("wrong W") exit() if H<1 or H>1000000000: print("wrong H") exit() N = int(input("N: ")) if N<1 or N>100000: print("wrong N") ...
s036486093
p00486
u013637113
1526639370
Python
Python3
py
Runtime Error
0
0
1200
import numpy def cal_time(W, H, x, y): return 2*(abs(W-x) + abs(H-y)) geo = input().split() W = int(geo[0]) H = int(geo[1]) if W<1 or W>1000000000: print("wrong W") exit() if H<1 or H>1000000000: print("wrong H") exit() N = int(input()) if N<1 or N>100000: print("wrong N") exit() total_...
s815565455
p00486
u013637113
1526639444
Python
Python3
py
Runtime Error
0
0
1200
import numpy def cal_time(W, H, x, y): return 2*(abs(W-x) + abs(H-y)) geo = input().split() W = int(geo[0]) H = int(geo[1]) if W<1 or W>1000000000: print("wrong W") exit() if H<1 or H>1000000000: print("wrong H") exit() N = int(input()) if N<1 or N>100000: print("wrong N") exit() total_...
s147410937
p00486
u013637113
1526639501
Python
Python3
py
Runtime Error
0
0
1193
import numpy def cal_time(W, H, x, y): return 2*(abs(W-x) + abs(H-y)) geo = input().split() W = int(geo[0]) H = int(geo[1]) if W<1 or W>1000000000: print("wrong W") exit() if H<1 or H>1000000000: print("wrong H") exit() N = int(input()) if N<1 or N>100000: print("wrong N") exit() total_...
s034538312
p00488
u633068244
1396361829
Python
Python
py
Runtime Error
0
0
70
print min([input() for i in [1,1,1])+min([input() for i in [1,1]]) -50
s720173128
p00489
u228488524
1506409497
Python
Python3
py
Runtime Error
0
0
622
t = int(input()) point_l = [0 for i in range(t)] for i in range((t*(t-1))/2): input_line = input() tmp = [int(x) for x in input_line.rstrip().split(' ')] if tmp[2] > tmp[3]: point_l[tmp[0]-1] += 3 elif tmp[3] > tmp[2]: point_l[tmp[1]-1] += 3 elif tmp[2] == tmp[3]: point_l[tmp...
s026676690
p00490
u749355444
1480492977
Python
Python
py
Runtime Error
0
0
213
A,B = map(int, raw_input().split()) C = input() D = [input() for _ in range(N)] D = sorted(D)[::-1] price = A cal = C ans = cal/price for d in D: cal += d price += B ans = max(ans, cal/price) print ans
s407584926
p00490
u749355444
1480493017
Python
Python
py
Runtime Error
0
0
213
A,B = map(int, raw_input().split()) C = input() D = [input() for _ in range(N)] D = sorted(D)[::-1] price = A cal = C ans = cal/price for d in D: cal += d price += B ans = max(ans, cal/price) print ans
s755047972
p00490
u749355444
1480493024
Python
Python3
py
Runtime Error
0
0
213
A,B = map(int, raw_input().split()) C = input() D = [input() for _ in range(N)] D = sorted(D)[::-1] price = A cal = C ans = cal/price for d in D: cal += d price += B ans = max(ans, cal/price) print ans
s559742873
p00490
u749355444
1480493033
Python
Python
py
Runtime Error
0
0
213
A,B = map(int, raw_input().split()) C = input() D = [input() for _ in range(N)] D = sorted(D)[::-1] price = A cal = C ans = cal/price for d in D: cal += d price += B ans = max(ans, cal/price) print ans