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
s330983816
p00741
u766477342
1420337502
Python
Python3
py
Runtime Error
0
0
578
while 1: W, H = list(map(int,input().split())) if W == 0:break C = [list(map(int, input().split())) for i in range(H) ] def work(x,y): ax = [-1, 0, 1, -1, 1, -1, 0, 1] ay = [-1, -1, -1, 0, 0, 1, 1, 1] if C[y][x] != 1:return False C[y][x] = -1 #mark for _ax in ...
s078533651
p00741
u316268279
1421209975
Python
Python3
py
Runtime Error
0
0
740
#!/usr/bin/env python # -*- coding: utf-8 -*- def dfs(s,Map,H,W,c): dxdy = [(1,0),(-1,0),(0,1),(0,-1),(1,1),(-1,-1),(-1,1),(1,-1)] for i in range(len(dxdy)): Map[s[0]][s[1]] = c nextPos = (s[0]+dxdy[i][0],s[1]+dxdy[i][1]) if nextPos[0] >= 0 and nextPos[1] >= 0 and nextPos[0] < H and nex...
s927168368
p00741
u316268279
1421211575
Python
Python3
py
Runtime Error
0
0
740
#!/usr/bin/env python # -*- coding: utf-8 -*- def dfs(s,Map,H,W,c): dxdy = [(1,0),(-1,0),(0,1),(0,-1),(1,1),(-1,-1),(-1,1),(1,-1)] for i in range(len(dxdy)): Map[s[0]][s[1]] = c nextPos = (s[0]+dxdy[i][0],s[1]+dxdy[i][1]) if nextPos[0] >= 0 and nextPos[1] >= 0 and nextPos[0] < H and nex...
s830911176
p00741
u316268279
1421211790
Python
Python3
py
Runtime Error
0
0
732
#!/usr/bin/env python # -*- coding: utf-8 -*- def dfs(s,Map,H,W,c): dxdy = [(1,0),(-1,0),(0,1),(0,-1),(1,1),(-1,-1),(-1,1),(1,-1)] for i in range(8): Map[s[0]][s[1]] = c nextPos = (s[0]+dxdy[i][0],s[1]+dxdy[i][1]) if nextPos[0] >= 0 and nextPos[1] >= 0 and nextPos[0] < H and nextPos[1] ...
s845816290
p00741
u316268279
1421211956
Python
Python3
py
Runtime Error
0
0
740
#!/usr/bin/env python # -*- coding: utf-8 -*- def dfs(s,Map,H,W,c): dxdy = [(1,0),(-1,0),(0,1),(0,-1),(1,1),(-1,-1),(-1,1),(1,-1)] for i in range(len(dxdy)): Map[s[0]][s[1]] = c nextPos = (s[0]+dxdy[i][0],s[1]+dxdy[i][1]) if nextPos[0] >= 0 and nextPos[1] >= 0 and nextPos[0] < H and nex...
s624524082
p00741
u316268279
1421212967
Python
Python3
py
Runtime Error
0
0
732
#!/usr/bin/env python # -*- coding: utf-8 -*- def dfs(s,Map,H,W,c): dxdy = [(1,0),(-1,0),(0,1),(0,-1),(1,1),(-1,-1),(-1,1),(1,-1)] for i in range(4): Map[s[0]][s[1]] = c nextPos = (s[0]+dxdy[i][0],s[1]+dxdy[i][1]) if nextPos[0] >= 0 and nextPos[1] >= 0 and nextPos[0] < H and nextPos[1] ...
s816205053
p00741
u316268279
1421213085
Python
Python3
py
Runtime Error
0
0
732
#!/usr/bin/env python # -*- coding: utf-8 -*- def dfs(s,Map,H,W,c): dxdy = [(1,0),(-1,0),(0,1),(0,-1),(1,1),(-1,-1),(-1,1),(1,-1)] for i in range(3): Map[s[0]][s[1]] = c nextPos = (s[0]+dxdy[i][0],s[1]+dxdy[i][1]) if nextPos[0] >= 0 and nextPos[1] >= 0 and nextPos[0] < H and nextPos[1] ...
s308452010
p00741
u633068244
1421783727
Python
Python
py
Runtime Error
0
0
480
def dfs(x, y): C[y][x] = 0 for dx,dy in zip([1,1,0,-1,-1,-1,0,1],[0,1,1,1,0,-1,-1,-1]): if 0 <= x+dx < w and 0 <= y+dy < h and C[y+dy][x+dx] == 1: dfs(x+dx, y+dy) while 1: w,h = map(int,raw_input().split()) if w == h == 0: break C = [map(int,raw_input().split()) for _ in xrange(...
s902360511
p00741
u731235119
1421922066
Python
Python
py
Runtime Error
0
0
1067
def travel(here, lb, ub, field, label): if field[here[1]][here[0]] == 1: field[here[1]][here[0]] = label if lb[0] < here[0] : travel((here[0]-1, here[1]), lb, ub, field, label) if lb[1] < here[1]: travel((here[0]-1, here[1]-1), lb, ub, field, label) if lb[1] < here[1] : travel((here[0], here[1]-1),...
s798469392
p00741
u120360464
1422864424
Python
Python
py
Runtime Error
0
0
883
#! /usr/bin/env python # -*- coding: utf-8 -*- def rec(y, x, used, TILE): if (not(0<=x<W)) or (not(0<=y<H)) or (TILE[y][x]==0) or (used[y][x]==1): return 0 else: used[y][x] = 1 rec(y-1, x-1, used, TILE) rec(y-1, x, used, TILE) rec(y-1, x+1, used, TILE) rec(y, x-1...
s858086583
p00741
u120360464
1422866808
Python
Python
py
Runtime Error
0
0
929
#! /usr/bin/env python # -*- coding: utf-8 -*- def rec(y, x, used, TILE): if (not(0<=x<W)) or (not(0<=y<H)) or (TILE[y][x]==0) or (used[y][x]==1): return 0 else: used[y][x] = 1 rec(y-1, x-1, used, TILE) rec(y-1, x, used, TILE) rec(y-1, x+1, used, TILE) rec(y, x-1...
s322222028
p00741
u124909914
1426138421
Python
Python3
py
Runtime Error
0
0
574
m = [] def walk(i,j): if i < 0 or j < 0 \ or i >= len(m) or j >= len(m[i]): return if m[i][j] == 0: return m[i][j] = 0 for k in range(-1,2): for l in range(-1,2): walk(i+k,j+l) while True: w, h = map(int, input().split()) if w == 0: break...
s903009363
p00741
u885631908
1435043031
Python
Python3
py
Runtime Error
0
0
453
w, h = map(int,input().split()) c = [list(map(int,input().split())) for j in range(h)] count = 0 def dfs(x,y): c[x][y] = 0 for dx in [-1,0,1]: for dy in [-1,0,1]: nx = x + dx ny = y + dy if(0 <= nx < w and 0 <= ny <= h and c[nx][ny] == 1 ): dfs(nx, ny...
s711216833
p00741
u885631908
1435043159
Python
Python3
py
Runtime Error
0
0
478
# -*- coding: utf-8 -*- w, h = map(int,input().split()) c = [list(map(int,input().split())) for j in range(h)] count = 0 def dfs(x,y): c[x][y] = 0 for dx in [-1,0,1]: for dy in [-1,0,1]: nx = x + dx ny = y + dy if(0 <= nx < w and 0 <= ny <= h and c[nx][ny] == 1 ): ...
s590866479
p00741
u885631908
1435044981
Python
Python3
py
Runtime Error
0
0
568
# -*- coding: utf-8 -*- def dfs(x,y): c[x][y] = 0 for dx in [-1,0,1]: for dy in [-1,0,1]: nx = x + dx ny = y + dy if 0 <= nx < h and 0 <= ny < w and c[nx][ny] == 1: dfs(nx, ny) while True: w, h = map(int,input().split()) if w == 0 and h == 0 :...
s118253971
p00741
u885631908
1435045158
Python
Python3
py
Runtime Error
0
0
566
# -*- coding: utf-8 -*- def dfs(x,y): c[x][y] = 0 for dx in [-1,0,1]: for dy in [-1,0,1]: nx = x + dx ny = y + dy if 0 <= nx < h and 0 <= ny < w and c[nx][ny] == 1: dfs(nx, ny) while True: w, h = map(int,input().split()) if w == 0 and h == 0 :...
s415440444
p00741
u885631908
1435045239
Python
Python3
py
Runtime Error
0
0
562
# -*- coding: utf-8 -*- def dfs(x,y): c[x][y] = 0 for dx in [-1,0,1]: for dy in [-1,0,1]: nx = x + dx ny = y + dy if 0 <= nx < h and 0 <= ny < w and c[nx][ny] == 1: dfs(nx, ny) while True: w, h = map(int,input().split()) if w == 0 and h == 0 ...
s620648098
p00741
u885631908
1435045374
Python
Python3
py
Runtime Error
0
0
566
# -*- coding: utf-8 -*- def dfs(x,y): c[x][y] = 0 for dx in [-1,0,1]: for dy in [-1,0,1]: nx = x + dx ny = y + dy if 0 <= nx < h and 0 <= ny < w and c[nx][ny] == 1: dfs(nx, ny) while True: w, h = map(int,input().split()) if w == 0 and h == 0 :...
s985738346
p00741
u885631908
1435045441
Python
Python3
py
Runtime Error
0
0
542
def dfs(x,y): c[x][y] = 0 for dx in [-1,0,1]: for dy in [-1,0,1]: nx = x + dx ny = y + dy if 0 <= nx < h and 0 <= ny < w and c[nx][ny] == 1: dfs(nx, ny) while True: w, h = map(int,input().split()) if w == 0 and h == 0 : break ...
s951702792
p00741
u885631908
1435143491
Python
Python3
py
Runtime Error
0
0
566
# -*- coding: utf-8 -*- def dfs(x,y): c[x][y] = 0 for dx in [-1,0,1]: for dy in [-1,0,1]: nx = x + dx ny = y + dy if 0 <= nx < h and 0 <= ny < w and c[nx][ny] == 1: dfs(nx, ny) while True: w, h = map(int,input().split()) if w == 0 and h == 0 :...
s008848033
p00741
u966364923
1436628577
Python
Python3
py
Runtime Error
0
0
675
def dfs(tiles, W, H, x, y): tiles[y][x] = '0' for dx,dy in ((-1,-1), (-1,0), (-1,1), (0,-1), (0,1), (1,-1), (1,0), (1,1)): if 0<=x+dx<W and 0<=y+dy<H and tiles[y+dy][x+dx]=='1': dfs(tiles, W, H, x+dx, y+dy) return def main(): while True: W,H = [int(x) for x in input().split(...
s153854768
p00741
u966364923
1436628857
Python
Python3
py
Runtime Error
0
0
719
import sys def dfs(tiles, W, H, x, y): tiles[y][x] = '0' for dx,dy in ((-1,-1), (-1,0), (-1,1), (0,-1), (0,1), (1,-1), (1,0), (1,1)): if 0<=x+dx<W and 0<=y+dy<H and tiles[y+dy][x+dx]=='1': dfs(tiles, W, H, x+dx, y+dy) return def main(): while True: W,H = [int(x) for x in inp...
s192600304
p00741
u489809100
1449145802
Python
Python
py
Runtime Error
0
0
818
def check(x, y): array[x][y] = "0" if array[x + 1][y] == "1" : check(x + 1, y) if array[x - 1][y] == "1" : check(x - 1, y) if array[x][y + 1] == "1" : check(x, y + 1) if array[x][y - 1] == "1" : check(x, y - 1) if array[x + 1][y + 1] == "1" : check(x + 1, y + 1) if array[x + 1][y - 1] == "1" : check(x + 1, y - 1...
s204116606
p00741
u489809100
1449145867
Python
Python
py
Runtime Error
0
0
860
import sys sys.setrecursionlimit(100000) def check(x, y): array[x][y] = "0" if array[x + 1][y] == "1" : check(x + 1, y) if array[x - 1][y] == "1" : check(x - 1, y) if array[x][y + 1] == "1" : check(x, y + 1) if array[x][y - 1] == "1" : check(x, y - 1) if array[x + 1][y + 1] == "1" : check(x + 1, y + 1) if array...
s853417183
p00741
u489809100
1449145880
Python
Python
py
Runtime Error
0
0
861
import sys sys.setrecursionlimit(1000000) def check(x, y): array[x][y] = "0" if array[x + 1][y] == "1" : check(x + 1, y) if array[x - 1][y] == "1" : check(x - 1, y) if array[x][y + 1] == "1" : check(x, y + 1) if array[x][y - 1] == "1" : check(x, y - 1) if array[x + 1][y + 1] == "1" : check(x + 1, y + 1) if arra...
s542809058
p00741
u489809100
1449145928
Python
Python
py
Runtime Error
0
0
862
import sys sys.setrecursionlimit(10000000) def check(x, y): array[x][y] = "0" if array[x + 1][y] == "1" : check(x + 1, y) if array[x - 1][y] == "1" : check(x - 1, y) if array[x][y + 1] == "1" : check(x, y + 1) if array[x][y - 1] == "1" : check(x, y - 1) if array[x + 1][y + 1] == "1" : check(x + 1, y + 1) if arr...
s077531170
p00741
u489809100
1449145940
Python
Python
py
Runtime Error
0
0
863
import sys sys.setrecursionlimit(100000000) def check(x, y): array[x][y] = "0" if array[x + 1][y] == "1" : check(x + 1, y) if array[x - 1][y] == "1" : check(x - 1, y) if array[x][y + 1] == "1" : check(x, y + 1) if array[x][y - 1] == "1" : check(x, y - 1) if array[x + 1][y + 1] == "1" : check(x + 1, y + 1) if ar...
s596000402
p00741
u489809100
1449145955
Python
Python
py
Runtime Error
0
0
864
import sys sys.setrecursionlimit(1000000000) def check(x, y): array[x][y] = "0" if array[x + 1][y] == "1" : check(x + 1, y) if array[x - 1][y] == "1" : check(x - 1, y) if array[x][y + 1] == "1" : check(x, y + 1) if array[x][y - 1] == "1" : check(x, y - 1) if array[x + 1][y + 1] == "1" : check(x + 1, y + 1) if a...
s814757686
p00741
u489809100
1449145968
Python
Python
py
Runtime Error
0
0
867
import sys sys.setrecursionlimit(1000000000000) def check(x, y): array[x][y] = "0" if array[x + 1][y] == "1" : check(x + 1, y) if array[x - 1][y] == "1" : check(x - 1, y) if array[x][y + 1] == "1" : check(x, y + 1) if array[x][y - 1] == "1" : check(x, y - 1) if array[x + 1][y + 1] == "1" : check(x + 1, y + 1) i...
s804376353
p00741
u489809100
1449146293
Python
Python
py
Runtime Error
0
0
818
def check(x, y): array[x][y] = "0" if array[x + 1][y] == "1" : check(x + 1, y) if array[x - 1][y] == "1" : check(x - 1, y) if array[x][y + 1] == "1" : check(x, y + 1) if array[x][y - 1] == "1" : check(x, y - 1) if array[x + 1][y + 1] == "1" : check(x + 1, y + 1) if array[x + 1][y - 1] == "1" : check(x + 1, y - 1...
s093489680
p00741
u489809100
1449146323
Python
Python
py
Runtime Error
0
0
862
import sys sys.setrecursionlimit(10000000) def check(x, y): array[x][y] = "0" if array[x + 1][y] == "1" : check(x + 1, y) if array[x - 1][y] == "1" : check(x - 1, y) if array[x][y + 1] == "1" : check(x, y + 1) if array[x][y - 1] == "1" : check(x, y - 1) if array[x + 1][y + 1] == "1" : check(x + 1, y + 1) if arr...
s619518286
p00741
u488601719
1453800417
Python
Python
py
Runtime Error
0
0
653
vx = [1, -1, 0, 0, 1, 1, -1, -1] vy = [0, 0, 1, -1, 1, -1, 1, -1] def dfs(col, row): c[col][row] = 0 for x, y in zip(vx, vy): ny = col + y nx = row + x if nx < 0 or ny < 0 or nx >= w or ny >= h: continue if c[ny][nx] == 0: continue dfs(ny, nx) w...
s538106669
p00741
u488601719
1453800439
Python
Python
py
Runtime Error
0
0
653
vx = [1, -1, 0, 0, 1, 1, -1, -1] vy = [0, 0, 1, -1, 1, -1, 1, -1] def dfs(col, row): c[col][row] = 0 for x, y in zip(vx, vy): ny = col + y nx = row + x if nx < 0 or ny < 0 or nx >= w or ny >= h: continue if c[ny][nx] == 0: continue dfs(ny, nx) w...
s585109656
p00741
u248416507
1464074912
Python
Python
py
Runtime Error
0
0
793
def visit(x, y, area): move = [(-1, 0), (0, 1), (1, 0), (0, -1), (1, -1), (1, 1), (-1, 1), (-1, -1)] for i in move: if 0 <= (x + i[0]) < w and 0 <= (y + i[1]) < h and area[y + i[1]][x + i[0]] == 1: area[y + i[1]][x + i[0]] = 0 visit(x + i[0], y + i[1], area) def solve(): a...
s168470209
p00741
u336892997
1465810090
Python
Python3
py
Runtime Error
0
0
785
def solve(): w, h = [int(x) for x in input().split()] if w == h == 0: return False field = [[int(x) for x in input().split()] for _ in range(h)] ans = 0 for x in range(w): for y in range(h): if field[y][x] > 0: mark(field, w, h, x, y) ans ...
s713101965
p00741
u660912567
1481281969
Python
Python3
py
Runtime Error
0
0
475
k = [-1,0,1] def search(x,y,m): if x<0 or x>=len(m[0]) or y<0 or y>=len(m): return if m[y][x]==0: return m[y][x] = 0 for i in k: for j in k: search(x+i,y+j,m) while True: c = 0 w,h = map(int,input().split()) if w==0: break m = [list(map(int,input().split())) for i in...
s380211737
p00741
u660912567
1481908561
Python
Python3
py
Runtime Error
0
0
454
d = [-1,0,1] def search(x,y,m): if not(0<=x<len(m[0]) and 0<=y<len(m)) or m[y][x]=='0': return m[y][x] = '0' for dy in d: for dx in d: search(x+dx,y+dy,m) while True: w,h = map(int,input().split()) if w==h==0: break m = [input().split() for _ in range(h)] c = 0 for y ...
s200327464
p00741
u661290476
1487494259
Python
Python3
py
Runtime Error
0
0
536
def erase(x, y): c[y][x] = '0' for dx, dy in ((1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1)): nx, ny = x + dx, y + dy if 0 <= nx <= w -1 and 0 <= ny <= h - 1: if c[ny][nx] == '1': erase(nx, ny) while True: w, h = map(int, input().split()) ...
s695047334
p00741
u661290476
1487494551
Python
Python3
py
Runtime Error
0
0
570
def erase(x, y): c[y][x] = '0' for dx, dy in ((1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1)): nx, ny = x + dx, y + dy if 0 <= nx <= w -1 and 0 <= ny <= h - 1: if c[ny][nx] == '1': erase(nx, ny) while True: w, h = map(int, input().split()) ...
s704981177
p00741
u661290476
1487495272
Python
Python3
py
Runtime Error
0
0
588
def erase(w, h, x, y): c[y][x] = '0' for dx, dy in ((1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1)): nx, ny = x + dx, y + dy if 0 <= nx <= w -1 and 0 <= ny <= h - 1: if c[ny][nx] == '1': erase(w, h, nx, ny) while True: w, h = map(int, input(...
s428399193
p00741
u078042885
1487498861
Python
Python3
py
Runtime Error
0
0
407
def f(x,y): a[y][x]='0' for dx,dy in[[-1,0],[1,0],[0,-1],[0,1],[-1,-1],[1,-1],[-1,1],[1,1]]: dx+=x;dy+=y if 0<=dx<w and 0<=dy<h and a[dy][dx]=='1':f(dx,dy) while 1: w,h=map(int,input().split()) if w==0:break a=[list(input().split()) for _ in[0]*h];b=0 for i in range(w): f...
s677201114
p00741
u078042885
1487498991
Python
Python3
py
Runtime Error
0
0
447
import sys sys.setrecursionlimit(1<<32) def f(x,y): a[y][x]='0' for dx,dy in[[-1,0],[1,0],[0,-1],[0,1],[-1,-1],[1,-1],[-1,1],[1,1]]: dx+=x;dy+=y if 0<=dx<w and 0<=dy<h and a[dy][dx]=='1':f(dx,dy) while 1: w,h=map(int,input().split()) if w==0:break a=[list(input().split()) for _ in[0]...
s650858426
p00741
u923668099
1495616620
Python
Python3
py
Runtime Error
0
0
839
import sys def solve(): while 1: w, h = map(int, sys.stdin.readline().split()) if w == h == 0: return room = [[int(j) for j in sys.stdin.readline().split()] for i in range(h)] cnt = 0 for i in range(h): for j in range(w): if room[i...
s024614965
p00741
u502536402
1524374814
Python
Python3
py
Runtime Error
0
0
814
#!python # -*- coding: utf-8 -*- import sys import numpy as np sys.setswitchinterval(10**8) next_s = ((-1, 1), (0, 1), (1, 1), (-1, 0), (1, 0), (-1, -1), (0, -1), (1, -1)) def DFS(x, y): if not (0 <= x < W and 0 <= y < H): return if not map_[y, x]: return map_[y, ...
s121003760
p00741
u502536402
1524374852
Python
Python3
py
Runtime Error
0
0
808
#!python # -*- coding: utf-8 -*- import sys import numpy as np sys.setswitchinterval(10**8) next_s = ((-1, 1), (0, 1), (1, 1), (-1, 0), (1, 0), (-1, -1), (0, -1), (1, -1)) def DFS(x, y): if not (0 <= x < W and 0 <= y < H): return if not map_[y, x]: return map_[y, ...
s845864334
p00741
u502536402
1524385852
Python
Python3
py
Runtime Error
0
0
808
#!python # -*- coding: utf-8 -*- import sys import numpy as np sys.setswitchinterval(10**8) next_s = ((-1, 1), (0, 1), (1, 1), (-1, 0), (1, 0), (-1, -1), (0, -1), (1, -1)) def DFS(x, y): if not (0 <= x < W and 0 <= y < H): return if not map_[y, x]: return map_[y, ...
s931229307
p00741
u502536402
1524386760
Python
Python3
py
Runtime Error
0
0
845
#!python # -*- coding: utf-8 -*- import sys import numpy as np sys.setswitchinterval(10**8) next_s = ((-1, 1), (0, 1), (1, 1), (-1, 0), (1, 0), (-1, -1), (0, -1), (1, -1)) def DFS(x, y): if not (0 <= x < W and 0 <= y < H): return if not map_[y * W + x]: return map...
s223014431
p00741
u502536402
1524386779
Python
Python3
py
Runtime Error
0
0
825
#!python # -*- coding: utf-8 -*- import sys sys.setswitchinterval(10**8) next_s = ((-1, 1), (0, 1), (1, 1), (-1, 0), (1, 0), (-1, -1), (0, -1), (1, -1)) def DFS(x, y): if not (0 <= x < W and 0 <= y < H): return if not map_[y * W + x]: return map_[y * W + x] = 0 ...
s645649142
p00741
u502536402
1524387022
Python
Python3
py
Runtime Error
0
0
705
import sys sys.setswitchinterval(10**8) next_s = ((-1, 1), (0, 1), (1, 1), (-1, 0), (1, 0), (-1, -1), (0, -1), (1, -1)) def DFS(x, y): if not (0 <= x < W and 0 <= y < H): return if not map_[y * W + x]: return map_[y * W + x] = 0 for dx, dy in next_s: DF...
s767661715
p00741
u502536402
1524583714
Python
Python3
py
Runtime Error
0
0
699
#!python # -*- coding: utf-8 -*- import sys sys.setswitchinterval(10**9) next_s = ((-1, 1), (0, 1), (1, 1), (-1, 0), (1, 0), (-1, -1), (0, -1), (1, -1)) def DFS(x, y): if not (0 <= x < W and 0 <= y < H): return if map_[y][x] == 0: return map_[y][x] = 0 for dx,...
s566066104
p00741
u502536402
1524583800
Python
Python3
py
Runtime Error
0
0
699
#!python # -*- coding: utf-8 -*- import sys sys.setswitchinterval(10**9) next_s = ((-1, 1), (0, 1), (1, 1), (-1, 0), (1, 0), (-1, -1), (0, -1), (1, -1)) def DFS(x, y): if not (0 <= x < W and 0 <= y < H): return if map_[y][x] == 0: return map_[y][x] = 0 for dx,...
s022326171
p00741
u023471147
1527037233
Python
Python3
py
Runtime Error
0
0
668
w, h = 0, 0 def dfs(x, y, data): data[x][y] = 0 for dx in range(-1, 2): for dy in range(-1, 2): sx, sy = x + dx, y + dy if sx < 0 or sx >= h or sy < 0 or sy >= w: continue if data[sx][sy] > 0: data = dfs(sx, sy, data) return data ...
s683381761
p00741
u572046143
1527955473
Python
Python3
py
Runtime Error
0
0
884
def dfs(field, i, j, w, h): field[i][j] = "0" OFFSETS = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] for di, dj in OFFSETS: if i+di < 0 or i+di >= h: continue if j+dj < 0 or j+dj >= w: continue if field[i+di][j+dj] == "1": dfs(field...
s262939366
p00741
u651355315
1529316158
Python
Python3
py
Runtime Error
0
0
673
# -*- coding: utf-8 -*- def search(n, m, tile, N, M): for dy, dx in zip([-1, -1, -1, 0, 0, 1, 1, 1], [-1, 0, 1, -1, 1, -1, 0, 1]): if 0 <= dy + n < N and 0 <= dx + m < M: if tile[dy + n][dx + m] == '1': tile[dy + n][dx + m] = '2' search(dy + n, dx + m, tile, N, ...
s376692078
p00741
u651355315
1529316173
Python
Python3
py
Runtime Error
0
0
673
# -*- coding: utf-8 -*- def search(n, m, tile, N, M): for dy, dx in zip([-1, -1, -1, 0, 0, 1, 1, 1], [-1, 0, 1, -1, 1, -1, 0, 1]): if 0 <= dy + n < N and 0 <= dx + m < M: if tile[dy + n][dx + m] == '1': tile[dy + n][dx + m] = '2' search(dy + n, dx + m, tile, N, ...
s271385216
p00741
u136916346
1530153932
Python
Python3
py
Runtime Error
0
0
731
def fill(y,x): global w,h,l if 0<=y<h and 0<=x+1<w and l[y][x+1]==1: l[y][x+1]=0 fill(y,x+1) if 0<=y<h and 0<=x-1<w and l[y][x-1]==1: l[y][x-1]=0 fill(y,x-1) if 0<=y+1<h and 0<=x<w and l[y+1][x]==1: l[y+1][x]=0 fill(y+1,x) if 0<=y-1<h and 0<=x<w and l[...
s287524542
p00741
u136916346
1530154342
Python
Python3
py
Runtime Error
0
0
1102
def fill(y,x): global w,h,l if 0<=y<h and 0<=x+1<w and l[y][x+1]==1: l[y][x+1]=0 fill(y,x+1) if 0<=y<h and 0<=x-1<w and l[y][x-1]==1: l[y][x-1]=0 fill(y,x-1) if 0<=y+1<h and 0<=x<w and l[y+1][x]==1: l[y+1][x]=0 fill(y+1,x) if 0<=y-1<h and 0<=x<w and l[...
s494968269
p00741
u136916346
1530154451
Python
Python3
py
Runtime Error
0
0
1107
def fill(y,x): global w,h,l if 0<=y<h and 0<=x+1<w and l[y][x+1]==1: l[y][x+1]=0 fill(y,x+1) if 0<=y<h and 0<=x-1<w and l[y][x-1]==1: l[y][x-1]=0 fill(y,x-1) if 0<=y+1<h and 0<=x<w and l[y+1][x]==1: l[y+1][x]=0 fill(y+1,x) if 0<=y-1<h and 0<=x<w and l[...
s120665732
p00741
u136916346
1530154765
Python
Python3
py
Runtime Error
0
0
1147
import sys sys.setrecursionlimit(10000) def fill(y,x): global w,h,l if 0<=y<h and 0<=x+1<w and l[y][x+1]==1: l[y][x+1]=0 fill(y,x+1) if 0<=y<h and 0<=x-1<w and l[y][x-1]==1: l[y][x-1]=0 fill(y,x-1) if 0<=y+1<h and 0<=x<w and l[y+1][x]==1: l[y+1][x]=0 fill(...
s838105007
p00741
u500292616
1530688201
Python
Python
py
Runtime Error
0
0
1381
# -*- coding: utf-8 -*- #150 島は幾つある? h,w=1,1 count=0 anser=0 def search(x,y): #マップの外側か壁の場合は何もしない #print(x,y) global count count+=1 if x<0 or x>w-1 or y<0 or y>h-1 or map_data[y][x]==0: return #以前に到達していたら何もしない if reached[y][x] ==0: return reached[y][x]...
s492978889
p00741
u500292616
1530688260
Python
Python
py
Runtime Error
0
0
1369
# -*- coding: utf-8 -*- #150 島は幾つある? h,w=1,1 count=0 anser=0 def search(x,y): #マップの外側か壁の場合は何もしない #print(x,y) global count count+=1 if x<0 or x>w-1 or y<0 or y>h-1 or map_data[y][x]==0: return #以前に到達していたら何もしない if reached[y][x] ==0: return reached[y][x]...
s645256540
p00741
u500292616
1530688273
Python
Python
py
Runtime Error
0
0
1346
#150 島は幾つある? h,w=1,1 count=0 anser=0 def search(x,y): #マップの外側か壁の場合は何もしない #print(x,y) global count count+=1 if x<0 or x>w-1 or y<0 or y>h-1 or map_data[y][x]==0: return #以前に到達していたら何もしない if reached[y][x] ==0: return reached[y][x]=0 #print("aa"...
s555100266
p00741
u500292616
1530688280
Python
Python3
py
Runtime Error
0
0
1346
#150 島は幾つある? h,w=1,1 count=0 anser=0 def search(x,y): #マップの外側か壁の場合は何もしない #print(x,y) global count count+=1 if x<0 or x>w-1 or y<0 or y>h-1 or map_data[y][x]==0: return #以前に到達していたら何もしない if reached[y][x] ==0: return reached[y][x]=0 #print("aa"...
s139661211
p00741
u500292616
1530688310
Python
Python3
py
Runtime Error
0
0
1369
# -*- coding: utf-8 -*- #150 島は幾つある? h,w=1,1 count=0 anser=0 def search(x,y): #マップの外側か壁の場合は何もしない #print(x,y) global count count+=1 if x<0 or x>w-1 or y<0 or y>h-1 or map_data[y][x]==0: return #以前に到達していたら何もしない if reached[y][x] ==0: return reached[y][x]...
s170287601
p00741
u500292616
1530688328
Python
Python
py
Runtime Error
0
0
1369
# -*- coding: utf-8 -*- #150 島は幾つある? h,w=1,1 count=0 anser=0 def search(x,y): #マップの外側か壁の場合は何もしない #print(x,y) global count count+=1 if x<0 or x>w-1 or y<0 or y>h-1 or map_data[y][x]==0: return #以前に到達していたら何もしない if reached[y][x] ==0: return reached[y][x]...
s561051344
p00741
u500292616
1530688392
Python
Python
py
Runtime Error
0
0
1318
h,w=1,1 count=0 anser=0 def search(x,y): #マップの外側か壁の場合は何もしない #print(x,y) global count count+=1 if x<0 or x>w-1 or y<0 or y>h-1 or map_data[y][x]==0: return #以前に到達していたら何もしない if reached[y][x] ==0: return reached[y][x]=0 #print("aa") searc...
s209767444
p00741
u500292616
1530688491
Python
Python
py
Runtime Error
0
0
1318
h,w=1,1 count=0 anser=0 def search(x,y): #マップの外側か壁の場合は何もしない #print(x,y) global count count+=1 if x<0 or x>w-1 or y<0 or y>h-1 or map_data[y][x]==0: return #以前に到達していたら何もしない if reached[y][x] ==0: return reached[y][x]=0 #print("aa") searc...
s804578463
p00741
u500292616
1530688612
Python
Python
py
Runtime Error
0
0
1367
# -*- coding: utf-8 -*- #150 島は幾つある? h,w=1,1 count=0 anser=0 def search(x,y): #マップの外側か壁の場合は何もしない #print(x,y) global count count+=1 if x<0 or x>w-1 or y<0 or y>h-1 or map_data[y][x]==0: return #以前に到達していたら何もしない if reached[y][x] ==0: return reached[y][x]...
s314047401
p00741
u500292616
1530688660
Python
Python3
py
Runtime Error
0
0
1367
# -*- coding: utf-8 -*- #150 島は幾つある? h,w=1,1 count=0 anser=0 def search(x,y): #マップの外側か壁の場合は何もしない #print(x,y) global count count+=1 if x<0 or x>w-1 or y<0 or y>h-1 or map_data[y][x]==0: return #以前に到達していたら何もしない if reached[y][x] ==0: return reached[y][x]...
s221341630
p00741
u500292616
1530689064
Python
Python
py
Runtime Error
0
0
1367
# -*- coding: utf-8 -*- #150 島は幾つある? h,w=1,1 count=0 anser=0 def search(x,y): #マップの外側か壁の場合は何もしない #print(x,y) global count count+=1 if x<0 or x>w-1 or y<0 or y>h-1 or map_data[y][x]==0: return #以前に到達していたら何もしない if reached[y][x] ==0: return reached[y][x]...
s268187374
p00741
u500292616
1530689425
Python
Python
py
Runtime Error
0
0
1368
# -*- coding: utf-8 -*- #150 島は幾つある? h,w=1,1 count=0 anser=0 def search(x,y): #マップの外側か壁の場合は何もしない #print(x,y) global count count+=1 if x<0 or x>w-1 or y<0 or y>h-1 or map_data[y][x]==0: return #以前に到達していたら何もしない if reached[y][x] ==0: return reached[y][x]...
s555522397
p00741
u500292616
1530693392
Python
Python
py
Runtime Error
0
0
1368
# -*- coding: utf-8 -*- #150 島は幾つある? h,w=1,1 count=0 anser=0 def search(x,y): #マップの外側か壁の場合は何もしない #print(x,y) global count count+=1 if x<0 or x>w-1 or y<0 or y>h-1 or map_data[y][x]==0: return #以前に到達していたら何もしない if reached[y][x] ==0: return reached[y][x]...
s160805073
p00741
u779627195
1352885304
Python
Python
py
Runtime Error
0
18000
769
def destroy(m, x, y): #print x,y if w-1 >= x >= 0 and h-1 >= y >= 0: if m[y][x] == 1: m[y][x] = 2 for i in xrange(-1, 2): for j in xrange(-1, 2): destroy(m, x+i, y+j) ...
s740984368
p00741
u779627195
1352885954
Python
Python
py
Runtime Error
0
18000
841
def destroy(m, x, y): #print x,y if m[y][x] == 1: m[y][x] = 2 for i in xrange(-1, 2): for j in xrange(-1, 2): if not (i == 0 and j == 0): if w-1 >= x+i >= 0 and h-1 >= y+j >= 0...
s769948074
p00741
u779627195
1352886597
Python
Python
py
Runtime Error
0
18000
920
def destroy(m, x, y): #print x,y v[y][x] = True if m[y][x] == 1: m[y][x] = 2 for i in xrange(-1, 2): for j in xrange(-1, 2): if w-1 >= x+i >= 0 and h-1 >= y+j >= 0: if ...
s050646372
p00741
u915761101
1352887057
Python
Python
py
Runtime Error
0
18000
872
def destroy(m, x, y): # print "(",x,y,")" if m[y][x] == 1: m[y][x] = 2 for i in xrange(-1, 2): for j in xrange(-1, 2): if not (i == 0 and j == 0): if w-1 >= x+i >= 0 and h-1 >= ...
s031354073
p00741
u915761101
1352887148
Python
Python
py
Runtime Error
0
18000
869
m=[] def destroy(x, y): # print "(",x,y,")" if m[y][x] == 1: m[y][x] = 2 for i in xrange(-1, 2): for j in xrange(-1, 2): if not (i == 0 and j == 0): if w-1 >= x+i >= 0 and h-1 ...
s391643442
p00741
u915761101
1352887212
Python
Python
py
Runtime Error
0
18000
892
import sys m=[] def destroy(x, y): print>>sys.stderr, "(",x,y,")" if m[y][x] == 1: m[y][x] = 2 for i in xrange(-1, 2): for j in xrange(-1, 2): if not (i == 0 and j == 0): if w...
s337814303
p00741
u915761101
1352887347
Python
Python
py
Runtime Error
0
18000
18
def f(): f() f()
s155645409
p00741
u915761101
1352887402
Python
Python
py
Runtime Error
0
18000
57
import sys def f(n): print>>sys.stderr, n f(n+1) f(1)
s863487122
p00741
u915761101
1352887462
Python
Python
py
Runtime Error
0
18000
74
import sys def f(n): if n%100==0: print>>sys.stderr, n f(n+1) f(1)
s458716348
p00741
u915761101
1352887614
Python
Python
py
Runtime Error
0
18000
931
import sys m=[] def destroy(x, y,n): if n%100==0: print>>sys.stderr, "(",x,y,")",n if m[y][x] == 1: m[y][x] = 2 for i in xrange(-1, 2): for j in xrange(-1, 2): if not (i == 0 and j == 0): ...
s284527528
p00741
u104911888
1368855811
Python
Python
py
Runtime Error
0
0
480
def dfs(x,y): C[y][x]=0 for dx in range(-1,2): for dy in range(-1,2): mx=x+dx my=y+dy if 0<=mx<w and 0<=my<h and C[my][mx]==1: dfs(mx,my) while True: w,h=map(int,raw_input().split()) if w==h==0:break C=[map(int,raw_input().split()) for i i...
s158288073
p00741
u104911888
1368855887
Python
Python
py
Runtime Error
0
0
491
def dfs(x,y): C[y][x]=0 for dx in range(-1,2): for dy in range(-1,2): mx=x+dx my=y+dy if 0<=mx<w and 0<=my<h and C[my][mx]==1: dfs(mx,my) return while True: w,h=map(int,raw_input().split()) if w==h==0:break C=[map(int,raw_input().split...
s382748150
p00741
u104911888
1369571163
Python
Python
py
Runtime Error
0
0
477
def dfs(i,j): C[i][j]=-1 for x in range(-1,2): for y in range(-1,2): mx=x+j my=y+i if 0<=mx<w and 0<=my<h and C[my][mx]==1: dfs(my,mx) while True: w,h=map(int,raw_input().split()) if w==h==0:break C=[map(int,raw_input().split()) for i in r...
s826728061
p00741
u104911888
1369571378
Python
Python
py
Runtime Error
0
0
525
def dfs(i,j): C[i][j]=-1 for x in range(-1,2): for y in range(-1,2): mx=x+j my=y+i if mx<0 or my<0 or mx>=w or my>=h: continue if C[my][mx]==1: dfs(my,mx) while True: w,h=map(int,raw_input().split()) if w==h==0:brea...
s252813235
p00741
u633068244
1399521327
Python
Python
py
Runtime Error
0
0
422
dxy = [[1,0],[0,1],[-1,0],[0,-1],[1,1],[-1,1],[-1,-1],[1,-1]] def solve(w,h): if 0 <= w < W and 0 <= h < H and field[h][w] == 1: field[h][w] = 0 for dx,dy in dxy: solve(w+dx,h+dy) while 1: W,H = map(int,raw_input().split()) if W == 0: break field = [map(int,raw_input().split()) for i in range(H)] ans = 0 ...
s419181813
p00741
u633068244
1399527599
Python
Python
py
Runtime Error
0
0
435
global field dxy = [[1,0],[0,1],[-1,0],[0,-1],[1,1],[-1,1],[-1,-1],[1,-1]] def solve(w,h): if 0 <= w < W and 0 <= h < H and field[h][w] == 1: field[h][w] = 0 for dx,dy in dxy: solve(w+dx,h+dy) while 1: W,H = map(int,raw_input().split()) if W == 0: break field = [map(int,raw_input().split()) for i in range(H...
s567116641
p00741
u633068244
1399528040
Python
Python
py
Runtime Error
0
0
440
dxy = [[1,0],[0,1],[-1,0],[0,-1],[1,1],[-1,1],[-1,-1],[1,-1]] def solve(field,w,h): if 0 <= w < W and 0 <= h < H and field[h][w] == 1: field[h][w] = 0 for dx,dy in dxy: solve(field,w+dx,h+dy) while 1: W,H = map(int,raw_input().split()) if W == 0: break field = [map(int,raw_input().split()) for i in range(H)...
s946789338
p00741
u633068244
1399528083
Python
Python
py
Runtime Error
0
0
469
dxy = [[1,0],[0,1],[-1,0],[0,-1],[1,1],[-1,1],[-1,-1],[1,-1]] def solve(field,w,h): if 0 <= w < W and 0 <= h < H and field[h][w] == 1: field[h][w] = 0 for dx,dy in dxy: solve(field,w+dx,h+dy) return 1 else: return 0 while 1: W,H = map(int,raw_input().split()) if W == 0: break field = [map(int,raw_input...
s073863723
p00741
u633068244
1399528821
Python
Python
py
Runtime Error
0
0
440
dwh = [[1,0],[0,1],[-1,0],[0,-1],[1,1],[-1,1],[-1,-1],[1,-1]] def solve(field,w,h): if 0 <= w < W and 0 <= h < H and field[h][w] == 1: field[h][w] = 0 for dw,dh in dwh: solve(field,w+dw,h+dh) while 1: W,H = map(int,raw_input().split()) if W == 0: break field = [map(int,raw_input().split()) for i in range(H)...
s779310074
p00741
u633068244
1399528922
Python
Python
py
Runtime Error
0
0
448
dwh = [[1,0],[0,1],[-1,0],[0,-1],[1,1],[-1,1],[-1,-1],[1,-1]] def solve(field,w,h): if 0 <= w < W and 0 <= h < H and field[h][w] == 1: field[h][w] = 0 for dw,dh in dwh: solve(field,w+dw,h+dh) return while 1: W,H = map(int,raw_input().split()) if W == 0: break field = [map(int,raw_input().split()) for i in ...
s316429501
p00742
u509278866
1535079648
Python
Python3
py
Runtime Error
0
0
2146
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 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....
s678376944
p00742
u082657995
1556804634
Python
Python3
py
Runtime Error
0
0
844
from collections import defaultdict from itertools import permutations while True: N = int(input()) if N==0: break non_zero = set() dd = defaultdict(int) for _ in range(N-1): s = input() for i, c in enumerate(s[::-1]): dd[c] += 10**i if len(s) != 1: ...
s659688797
p00742
u082657995
1556805259
Python
Python3
py
Runtime Error
0
0
829
from collections import defaultdict from itertools import permutations while True: N = int(input()) if N==0: break non_zero = set() dd = defaultdict(int) for _ in range(N-1): s = input() for i, c in enumerate(s[::-1]): dd[c] += 10**i if len(s) != 1: ...
s841751376
p00742
u082657995
1556810757
Python
Python3
py
Runtime Error
0
0
1118
from collections import defaultdict from itertools import permutations import gc while True: N = int(input()) if N==0: break non_zero = set() dd = defaultdict(int) for _ in range(N-1): s = input() for i, c in enumerate(s[::-1]): dd[c] += 10**i if len(s) ...
s427690322
p00742
u082657995
1556810988
Python
Python3
py
Runtime Error
0
0
1119
from collections import defaultdict from itertools import permutations while True: N = int(input()) if N==0: break non_zero = set() dd = defaultdict(int) for _ in range(N-1): s = input() for i, c in enumerate(s[::-1]): dd[c] += 10**i if len(s) != 1: ...
s997893253
p00742
u082657995
1556811047
Python
Python3
py
Runtime Error
0
0
1124
from collections import defaultdict from itertools import permutations while True: N = int(input()) if N==0: break non_zero = set() dd = defaultdict(int) for _ in range(N-1): s = input() for i, c in enumerate(s[::-1]): dd[c] += 10**i if len(s) != 1: ...
s440846598
p00742
u260980560
1501168743
Python
Python3
py
Runtime Error
40000
8024
893
from collections import deque def solve(n, S): C = {}; E = {} for i, s in enumerate(S): v = 1 for c in reversed(s): if c not in C: C[c] = 1 if i < n-1: E[c] = E.get(c, 0) + v else: E[c] = E.get(c, 0) - v ...
s670816197
p00744
u871901071
1405335538
Python
Python3
py
Runtime Error
39860
98528
2125
from collections import deque inf = 1000000000 def bfs(graph, s, t): V = len(graph) q = deque([(s, -1, -1)]) prev = [(-1, -1)] * V visited = [False] * V while len(q) > 0: (v, p, e) = q.popleft() if visited[v]: continue visited[v] = True prev[v] = p, e ...