problem_id stringlengths 6 6 | user_id stringlengths 10 10 | time_limit float64 1k 8k | memory_limit float64 262k 1.05M | problem_description stringlengths 48 1.55k | codes stringlengths 35 98.9k | status stringlengths 28 1.7k | submission_ids stringlengths 28 1.41k | memories stringlengths 13 808 | cpu_times stringlengths 11 610 | code_sizes stringlengths 7 505 |
|---|---|---|---|---|---|---|---|---|---|---|
p02734 | u619819312 | 2,000 | 1,048,576 | Given are a sequence of N integers A_1, A_2, \ldots, A_N and a positive integer S. For a pair of integers (L, R) such that 1\leq L \leq R \leq N, let us define f(L, R) as follows: * f(L, R) is the number of sequences of integers (x_1, x_2, \ldots , x_k) such that L \leq x_1 < x_2 < \cdots < x_k \leq R and A_{x_1... | ['import numpy as np\nn,s=map(int,input().split())\nt=np.zeros(s+1)\nm=10**9+7\na=list(map(int,input().split()))\nans=0\nfor i in range(n):\n t[a[i]:]+=t[:-a[i]]\n if a[i]<s:\n t[a[i]]+=i+1\n ans+=t[-1]\n ans%=m\nprint(int(ans))', 'n,s=map(int,input().split())\nt=[0]*(s+1)\nm=998244353\na=list(map(in... | ['Runtime Error', 'Accepted'] | ['s006657110', 's366675738'] | [12512.0, 3808.0] | [192.0, 1793.0] | [233, 266] |
p02734 | u627803856 | 2,000 | 1,048,576 | Given are a sequence of N integers A_1, A_2, \ldots, A_N and a positive integer S. For a pair of integers (L, R) such that 1\leq L \leq R \leq N, let us define f(L, R) as follows: * f(L, R) is the number of sequences of integers (x_1, x_2, \ldots , x_k) such that L \leq x_1 < x_2 < \cdots < x_k \leq R and A_{x_1... | ['import numpy as np\n\nn, s = map(int, input().split())\nA = list(map(int, input().split()))\nMOD = 998244353\n\nU = 3010\ncount = 0\nF = np.zeros(U + 1, np.int64)\nfor a in A:\n F[0] += 1\n \n # FF = F\n # FF[a:] += FF[:-a]\n # FF %= MOD\n # F = FF\n F[a:] += F[:-a].copy()\n F %= MOD # forgot\... | ['Wrong Answer', 'Accepted'] | ['s019019614', 's355514770'] | [12768.0, 14428.0] | [1298.0, 302.0] | [398, 265] |
p02734 | u671861352 | 2,000 | 1,048,576 | Given are a sequence of N integers A_1, A_2, \ldots, A_N and a positive integer S. For a pair of integers (L, R) such that 1\leq L \leq R \leq N, let us define f(L, R) as follows: * f(L, R) is the number of sequences of integers (x_1, x_2, \ldots , x_k) such that L \leq x_1 < x_2 < \cdots < x_k \leq R and A_{x_1... | ['#!python3\n\nimport numpy as np\n\n# input\nN, S = list(map(int, input().split()))\nA = list(map(int, input().split()))\n\nMOD = 998244353\n\n\ndef add_elements(w, i):\n a = A[i]\n w[a:] += w[:-a]\n if a <= S:\n w[a] += i + 1\n w %= MOD\n\n\ndef main():\n w = np.zeros(S + 1, dtype=int)\n ans ... | ['Wrong Answer', 'Accepted'] | ['s270362175', 's730727320'] | [15288.0, 14412.0] | [2108.0, 309.0] | [464, 451] |
p02734 | u704284486 | 2,000 | 1,048,576 | Given are a sequence of N integers A_1, A_2, \ldots, A_N and a positive integer S. For a pair of integers (L, R) such that 1\leq L \leq R \leq N, let us define f(L, R) as follows: * f(L, R) is the number of sequences of integers (x_1, x_2, \ldots , x_k) such that L \leq x_1 < x_2 < \cdots < x_k \leq R and A_{x_1... | ['from sys import stdin\nmod = 998244353\ndef solveAsPolynomial():\n from numpy import *\n N,S = map(int,stdin.readline().split())\n a = list(map(int,stdin.readline().split()))\n ans = 0\n f = np.zeros(S+1,int64)\n for A in a:\n \n f[0] += 1#f+1\n f[A:] += f[:-A].copy()#f*(1+x**A)... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s223218019', 's357102928', 's928558182'] | [3064.0, 17240.0, 13748.0] | [17.0, 2108.0, 305.0] | [645, 732, 648] |
p02734 | u726285999 | 2,000 | 1,048,576 | Given are a sequence of N integers A_1, A_2, \ldots, A_N and a positive integer S. For a pair of integers (L, R) such that 1\leq L \leq R \leq N, let us define f(L, R) as follows: * f(L, R) is the number of sequences of integers (x_1, x_2, \ldots , x_k) such that L \leq x_1 < x_2 < \cdots < x_k \leq R and A_{x_1... | ['import numpy as np\n\nN, S = map(int, input().split())\nx = [int(x) for x in input().split()]\n \n\nm = np.zeros((S+1,3))\np = np.zeros((S+1,3))\np[0,0] = 1\n\n\nfor i in range(1,N+1):\n \n \n m[:,0] = p[:,0]\n m[:,1] = p[:,0] + p[:,1] \n m[:,2] = p[:,0] + p[:,1] + p[:,2] \n\n \n m[x[i]:,1] += ... | ['Runtime Error', 'Accepted'] | ['s407574627', 's596292570'] | [12664.0, 12664.0] | [152.0, 1015.0] | [809, 813] |
p02734 | u814986259 | 2,000 | 1,048,576 | Given are a sequence of N integers A_1, A_2, \ldots, A_N and a positive integer S. For a pair of integers (L, R) such that 1\leq L \leq R \leq N, let us define f(L, R) as follows: * f(L, R) is the number of sequences of integers (x_1, x_2, \ldots , x_k) such that L \leq x_1 < x_2 < \cdots < x_k \leq R and A_{x_1... | ['def main():\n N, S = map(int, input().split())\n A = list(map(int, input().split()))\n mod = 998244353\n ans = 0\n dp = [0]*S\n\n for i, a in enumerate(A):\n if a > S:\n continue\n ans += dp[S-a]*(N-i)\n dp[0] += 1\n for j in range(S-a-1, -1, -1):\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s563640979', 's783567207', 's656672121'] | [3444.0, 3804.0, 3816.0] | [967.0, 1077.0, 1063.0] | [351, 353, 351] |
p02734 | u864197622 | 2,000 | 1,048,576 | Given are a sequence of N integers A_1, A_2, \ldots, A_N and a positive integer S. For a pair of integers (L, R) such that 1\leq L \leq R \leq N, let us define f(L, R) as follows: * f(L, R) is the number of sequences of integers (x_1, x_2, \ldots , x_k) such that L \leq x_1 < x_2 < \cdots < x_k \leq R and A_{x_1... | ['def setM():\n K2 = K // 2\n k = K // 2\n while k:\n m = int(("1" * (K2 - k) + "0" * (K2 + k)) * 3001, 2)\n M.append((k, m, ~m, (1 << K2 + k) % P))\n k //= 2\n\ndef modp(n):\n K2 = K // 2\n k = K // 2\n for k, m, tm, a in M:\n n = (n & tm) + (n & m >> K2 + k) * a\n retu... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s022251351', 's402688290', 's484628135', 's078045053'] | [3640.0, 3316.0, 3064.0, 3316.0] | [809.0, 126.0, 17.0, 100.0] | [591, 334, 340, 332] |
p02734 | u893063840 | 2,000 | 1,048,576 | Given are a sequence of N integers A_1, A_2, \ldots, A_N and a positive integer S. For a pair of integers (L, R) such that 1\leq L \leq R \leq N, let us define f(L, R) as follows: * f(L, R) is the number of sequences of integers (x_1, x_2, \ldots , x_k) such that L \leq x_1 < x_2 < \cdots < x_k \leq R and A_{x_1... | ['n, s = map(int, input().split())\na = list(map(int, input().split()))\nmod = 998244353\n\ndp1 = [[0] * (s + 1) for _ in range(n + 1)]\ndp1[0][0] = 1\n\nfor i, e in enumerate(a, 1):\n for j in range(1, s + 1):\n if j - e >= 0:\n dp1[i][j] = dp1[i-1][j] + dp1[i-1][j-e]\n else:\n d... | ['Wrong Answer', 'Accepted'] | ['s957949157', 's539825406'] | [157936.0, 20856.0] | [2114.0, 703.0] | [817, 394] |
p02734 | u987164499 | 2,000 | 1,048,576 | Given are a sequence of N integers A_1, A_2, \ldots, A_N and a positive integer S. For a pair of integers (L, R) such that 1\leq L \leq R \leq N, let us define f(L, R) as follows: * f(L, R) is the number of sequences of integers (x_1, x_2, \ldots , x_k) such that L \leq x_1 < x_2 < \cdots < x_k \leq R and A_{x_1... | ['import numpy as np\n\nn,s = map(int,input().split())\na = list(map(int,input().split()))\nans = 0\nmod = 998244353\n\n\nf = np.zeros(s+1)\n\nfor i in a:\n f[0] += 1\n f[i:] += f[:-i].copy()\n f %= mod\n ans += f[s]\n\nprint(ans)', 'import numpy as np\n\nn,s = map(int,input().split())\na = list(map(int,inp... | ['Wrong Answer', 'Accepted'] | ['s699084688', 's965745912'] | [12760.0, 12420.0] | [300.0, 298.0] | [261, 269] |
p02735 | u021019433 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ["from itertools import count, repeat\n\nh = int(input().split()[0])\na0 = repeat('.')\nr0 = list(range(w))\nfor i in range(h):\n a = input()\n r = [i]\n for x, y, z, u in zip(a0, '.' + a, a, r0):\n r.append(min(u + (x + z == '.\n a0 = a\n r0 = r[1:]\nprint(r[-1])\n", "from itertools import count, repeat\n\nh =... | ['Runtime Error', 'Accepted'] | ['s629467674', 's455055096'] | [3060.0, 3060.0] | [18.0, 24.0] | [289, 266] |
p02735 | u035901835 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ["import numpy as np\n\nH,W = input().split()\nH,W=int(H),int(W)\nP=[0]*H\nfor i in range(H):\n P[i] = input()\n\ndp=np.zeros((H,W),dtype='u8')\nif P[0][0]=='#':\n dp[0][0]=1\nelse:\n dp[0][0]=0\n\ndef DP(x,y):\n global dp\n if 0<=x<=W-1 and 0<=y<=H-1:\n return dp[y][x]\n else:\n return ... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s057657797', 's465561521', 's546715635', 's758321119', 's899304671', 's003323632'] | [21760.0, 3064.0, 14548.0, 3192.0, 3064.0, 13444.0] | [465.0, 30.0, 246.0, 30.0, 31.0, 307.0] | [861, 1024, 671, 993, 1216, 861] |
p02735 | u044220565 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ["# coding: utf-8\nH, W = list(map(int, input().split()))\nS = []\nfor _ in range(H):\n S.append(list(input()))\n\ngrid = [[0 for _ in range(W)] for _ in range(H)]\n\nfor h in range(1,H):\n if S[h-1][0] == '#' and S[h][0] == '.':\n grid[h][0] = grid[h-1][0] + 1\n else:\n grid[h][0] = grid[h-1][0]\n \nfor ... | ['Wrong Answer', 'Accepted'] | ['s355439546', 's206984440'] | [3316.0, 3316.0] | [31.0, 29.0] | [844, 818] |
p02735 | u060736237 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['black = 1\ncount = 0\nflag = False\ndef check(board, now):\n global flag, count\n if now[0] > len(board) -2 or board[now[0]+1][now[1]]==black:\n if now[1] > len(board[0]) -2 or board[now[0]][now[1]+1]==black:\n if flag == False:\n count += 1\n flag = True\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s372701813', 's753124158', 's153383316'] | [3172.0, 3060.0, 3316.0] | [18.0, 18.0, 345.0] | [1128, 376, 690] |
p02735 | u105709022 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['memory = [[-1 for i in range(W)] for j in range(H)]\ndef flip_count_mem(r, c):\n if memory[r][c] < 0:\n memory[r][c] = flip_coumt(r, c)\n return memory[r][c]\n\ndef flip_count (r, c):\n if r == H - 1 and c == W - 1:\n if s[r][c] == "#":\n return 1\n else:\n return 0\n \n if c == W - 1:\n co... | ['Runtime Error', 'Accepted'] | ['s707797927', 's316749748'] | [3064.0, 3316.0] | [18.0, 31.0] | [806, 806] |
p02735 | u110199424 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['import queue\n\nH, W = map(int, input().split())\n\ns = [list(map(int, input().split())) for _ in range(H)]\n\nini = 0\nif s[0][0] == \'#\':\n ini = 1\n\ndist = [[ini for _ in range(W)] for _ in range(H)]\nstart = (0,0)\n\nqq = queue.Queue()\n\nfor i in range(H):\n for j in range(W):\n tgt = []\n ... | ['Runtime Error', 'Accepted'] | ['s604381587', 's359879736'] | [3952.0, 4080.0] | [26.0, 41.0] | [802, 784] |
p02735 | u113971909 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ["#!/usr/bin/env python3\n# -*- coding:utf-8 -*-\n\nimport sys\nfrom collections import deque\n\ndef main():\n input = sys.stdin.readline\n H,W = map(int,input().split())\n Gd = [list(input()) for _ in range(H)]\n INF = H*W\n direc = [[1,0],[0,1]]\n def dfs(start):\n Dis = [[INF]*W for _ in ran... | ['Time Limit Exceeded', 'Accepted'] | ['s596701019', 's439224589'] | [109300.0, 9356.0] | [2114.0, 41.0] | [907, 723] |
p02735 | u139112865 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ["import heapq\nh, w = map(int, input().split())\nc = [input() for _ in range(h)]\n \nd=[[100000]*w for _ in range(h)]\n \ndef bfs():\n if c[0][0] == '.':\n que = [(0, (0, 0))]\n heapq.heapify(que)\n d[0][0] = 0\n else:\n que = [(1, (0, 0))]\n heapq.heapify(que)\n d[0][0]... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s248368817', 's346222969', 's328564725'] | [79092.0, 3188.0, 3188.0] | [2108.0, 48.0, 55.0] | [697, 882, 818] |
p02735 | u177411511 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy\n\nsys.setrecursionlimit(10**7)\ninf = 10**20\nmod = 10**9 + 7\n\nstdin = sys.stdin\n\nni = lambda: int(ns())\nna = lambda: list(map(int, stdin.readline().split()))\nns = lambda: stdin.readline().rstrip() # ignore trailing... | ['Runtime Error', 'Accepted'] | ['s730463682', 's111830958'] | [11012.0, 10928.0] | [36.0, 49.0] | [839, 839] |
p02735 | u185948224 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ["import sys\ninput = sys.stdin.readline\n\nH, W = map(int, input().split())\ns = ['0' * (W+2)]\nfor _ in range(H):\n s.append('0' + input().rstrip() + '0')\ns.append('0' * (W+2))\n\nans = []\nif s[1][1] == '#': a = 1\nelse: a = 0\ntemp = [[1, 1, a]]\n\nwhile temp:\n p = temp.pop()\n for y, x in [[p[0]+1, p[1]... | ['Runtime Error', 'Accepted'] | ['s880900227', 's317925518'] | [4960.0, 3188.0] | [2104.0, 33.0] | [567, 648] |
p02735 | u188745744 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['H,W=list(map(int,input().split()))\nl=[list(input()) for i in range(H)]\nDP=[[201]*W for i in range(H)]\nDP[0][0]=0\nfor y in range(H):\n for x in range(W):\n if x ==0 and y==0:\n DP[y][x] += 1 if l[y][x] == "#" else 0\n continue\n elif x == 0:\n DP[y][x] = DP[y-1][x]\n elif y... | ['Wrong Answer', 'Accepted'] | ['s716510221', 's211435430'] | [3444.0, 9392.0] | [27.0, 41.0] | [478, 458] |
p02735 | u204616996 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ["import sys\ninput = sys.stdin.readline\nH,W=map(int,input().split())\nS=[list(input()) for i in range(H)]\ndp=[0]*W\nif S[0][0]=='#':\n dp[0]=1\nfor j in range(1,W):\n if S[0][j]!=S[0][j-1]:\n dp[j]=dp[j-1]+1\n else:\n dp[j]=dp[j-1]\n\nfor i in range(1,H):\n print(dp)\n if S[i][0]!=S[i-1][0]:\n dp[0]=dp... | ['Wrong Answer', 'Accepted'] | ['s779120617', 's906992638'] | [3188.0, 3188.0] | [30.0, 29.0] | [511, 526] |
p02735 | u210827208 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ["import heapq\n \nh,w=map(int,input().split())\nS=[]\nfor i in range(h):\n S.append(input())\n \nvisited=[[0]*w for _ in range(h)]\n \nq=[(0,0,0)]\n \nheapq.heapify(q)\nvisited=[[0]*w for _ in range(h)]\ncnt=0\nD=[[0]*w for _ in range(h)]\nwhile q:\n cnt,px,py=heapq.heappop(q)\n D[px][py]=min(cnt,D[px][py]... | ['Wrong Answer', 'Accepted'] | ['s514489326', 's571310894'] | [3316.0, 3064.0] | [64.0, 43.0] | [680, 558] |
p02735 | u230117534 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['def flip_sq(sy, sx):\n gy = sy\n gx = sx\n while True:\n if sx == W - 1:\n if tiles[sy+1][sx] == "#":\n sy += 1\n else:\n break\n elif tiles[sy][sx+1] == "#":\n sx += 1\n if sy == H - 1:\n break\n ... | ['Runtime Error', 'Accepted'] | ['s644555006', 's509022789'] | [134572.0, 3188.0] | [1890.0, 33.0] | [1321, 643] |
p02735 | u231189826 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['from collections import deque\n\nH,W = list(map(int, input().split()))\nmaze = [input() for _ in range(H)]\n\ndef bfs(maze,visited,gx,gy):\n stack = deque([[0,0]])\n if maze[0][0] == \'#\':\n visited[0][0] = 1 \n else:\n visited[0][0] = 0 \n while stack:\n print(stack)\n print(... | ['Wrong Answer', 'Accepted'] | ['s686612698', 's174583425'] | [77588.0, 3572.0] | [2104.0, 128.0] | [1151, 1059] |
p02735 | u239528020 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['import numpy as np\nH, W = map(int, input().split())\n\nS = [list(str(input())) for i in range(H)]\nS = np.array(S)\n\ndp = np.zeros((H,W), dtype=np.int)\n\ndp[0,:] = np.cumsum(S[0,:]=="#")\ndp[:,0] = np.cumsum(S[:,0]=="#")\n\nfor i in range(1, H):\n for j in range(1, W):\n if S[i,j] == "#":\n dp... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s169568945', 's374284737', 's779143847', 's788613021', 's800519510', 's836501685', 's868882444', 's071777133'] | [21960.0, 21944.0, 12640.0, 12616.0, 14416.0, 21580.0, 12484.0, 3188.0] | [362.0, 974.0, 190.0, 190.0, 194.0, 1574.0, 219.0, 32.0] | [378, 470, 1325, 1241, 1114, 395, 386, 947] |
p02735 | u290187182 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ["import sys\nimport copy\nimport math\nimport fractions\n\nimport bisect\nimport pprint\nimport bisect\nfrom functools import reduce\nfrom copy import deepcopy\nfrom collections import deque\nimport numpy as np\nfrom decimal import *\nsys.setrecursionlimit(10 ** 6)\n\ndef CalcList(list):\n bfnum = -1\n afterList... | ['Runtime Error', 'Accepted'] | ['s927526706', 's266728979'] | [21996.0, 13672.0] | [292.0, 654.0] | [1141, 1280] |
p02735 | u291988695 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['h,w=map(int,input().split())\nli=[[]]*h\nfor i in range(h):\n li[i]=[str(k) for k in input()]\n \nlil=[[0 for i in range(w)] for j in range(h)]\n\nfor i in range(h):\n for j in range(w):\n if i==0 and j==0:\n if li[0][0]==".":\n lil[0][0]=0\n else:\n lil[0][0]=1\n elif i==0:\n if... | ['Wrong Answer', 'Accepted'] | ['s032810901', 's371365992'] | [3316.0, 3316.0] | [31.0, 33.0] | [806, 926] |
p02735 | u311379832 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ["import copy\nH, W = map(int, input().split())\ns = [[0] * W]\nminus = 0\ntmp = [list(input()) for _ in range(H)]\nfor i in range(H):\n s.append(tmp[i])\nif s[1][0] == '#':\n minus = 1\n for i in range(W):\n s[0][i] = 1\nelse:\n s[0][0] = 0\n\nscopy = copy.deepcopy(s)\nfor i in range(1, H + 1):\n ... | ['Wrong Answer', 'Accepted'] | ['s292432583', 's771992801'] | [3828.0, 3316.0] | [46.0, 34.0] | [1424, 606] |
p02735 | u321035578 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ["def main():\n h,w = map(int, input().split())\n s = []\n for i in range(h):\n ss = list(input())\n s.append(ss)\n\n now = [0,0]\n cnt = 0\n if s[0][0] == '#':\n cnt += 1\n # s[0][0] = '.'\n if s[h-1][w-1] == '#':\n # cnt += 1\n # s[h-1][w-1] = '.'\n\n ... | ['Runtime Error', 'Accepted'] | ['s424465837', 's576015191'] | [2940.0, 3188.0] | [17.0, 26.0] | [1114, 1031] |
p02735 | u329407311 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['H,W=map(int,input().split())\n\ndp = [[0 for i in range(W)] for j in range(H)]\n\narr = []\nfor h in range(H):\n s = list(input())\n arr.append(s)\n\nif arr[0][0] == "#":\n dp[0][0] = 1\n \nfor h in range(H):\n for w in range(W):\n if h == 0:\n if w != 0:\n a = arr[h][w]\n b = arr[h][w-1]\n... | ['Wrong Answer', 'Accepted'] | ['s955199786', 's097492872'] | [3316.0, 3316.0] | [29.0, 30.0] | [873, 982] |
p02735 | u354126779 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['h,w=map(int,input().split())\n\nm=[input() for i in range(w)]\n\ncnt=[[1000000 for i in range(h)] for j in range(w)]\n\n\n\nprint(0)\n', 'print(0)\n', 'h,w=map(int,input().split())\n\nm=[input() for i in range(w)]\n\nprint("A")\ncnt=[[1000000 for i in range(h)] for j in range(w)]\n\nif m[0][0]=="#":\n cnt[0][0]=1\... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s066706461', 's306753701', 's413189908', 's468572139', 's682715578', 's838493153', 's819128921'] | [3060.0, 2940.0, 3188.0, 3444.0, 3316.0, 3056.0, 3188.0] | [18.0, 17.0, 31.0, 32.0, 21.0, 17.0, 32.0] | [125, 9, 626, 626, 180, 73, 615] |
p02735 | u357949405 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ["H, W = map(int, input().split())\nS = [input() for _ in range(H)]\n\ndp = [[0 for _ in range(W)] for _ in range(H)]\n\nif S[0][0] == '#':\n dp[0][0] = 1\n\nfor i in range(1, W):\n if S[0][i] == '#':\n dp[0][i] = dp[0][i-1] + 1\n else:\n dp[0][i] = dp[0][i-1]\n\nfor j in range(1, H):\n if S[j... | ['Wrong Answer', 'Accepted'] | ['s203619589', 's479157820'] | [3188.0, 3316.0] | [24.0, 33.0] | [597, 984] |
p02735 | u371763408 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['H, W = map(int,input().split())\nS = [input() for i in range(H)]\ndp = [[0 for _ in range(W)] for _ in range(H)]\ndp[0][0] = 1 if S[0][0] == "#" else 0\n\nfor i in range(1,H):\n for j in range(1,W):\n up = dp[i-1][j] + (1 if S[i-1][j] != "#" and S[i][j] == "#" else 0) \n left = dp[i][j-1] + (1 if S[i... | ['Wrong Answer', 'Accepted'] | ['s285530989', 's082661125'] | [3064.0, 3436.0] | [28.0, 32.0] | [401, 839] |
p02735 | u374531474 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ["H, W = map(int, input().split())\ns = [input() for i in range(H)]\n\ndp = [[0] * W for i in range(H)]\n\nfor i in range(H):\n for j in range(W):\n c = []\n if 0 <= i - 1 < H:\n c.append(dp[i - 1][j])\n if 0 <= j - 1 < W:\n c.append(dp[i][j - 1])\n if len(c) > 0:\n ... | ['Wrong Answer', 'Accepted'] | ['s489894818', 's623326927'] | [3316.0, 3064.0] | [33.0, 33.0] | [421, 614] |
p02735 | u379716238 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ["H, W = map(int, input().split())\ns = []\nfor _ in range(H):\n s.append(input())\n \ndef main(H, W, s):\n \n \n INF = float('inf')\n dp = [[INF]*W for _ in range(H)]\n if s[0][0] == '#':\n dp[0][0] = 1\n else:\n dp[0][0] = 0\n\n dx = (1, 0)\n dy = (0, 1)\n for i in range(H):\n for j in range(W):\n... | ['Wrong Answer', 'Accepted'] | ['s969603715', 's735305171'] | [3316.0, 3064.0] | [36.0, 35.0] | [690, 669] |
p02735 | u442877951 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ["ans = 0\nH,W = map(int,input().split())\ns = [list(input()) for _ in range(W)]\nif s[H-1][W-1] == '#':\n ans += 1\nif s[0][0] == '#':\n ans += 1\nfor i in range(H):\n for j in range(W):\n if s[i][j] == '.':\n s[i][j] = 0\n else:\n s[i][j] = 1\n \n\nprint(ans)", 'ans = 0\nH,W = map(int,input().... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s527887675', 's864486120', 's904683075'] | [3064.0, 3060.0, 3188.0] | [20.0, 18.0, 28.0] | [268, 88, 497] |
p02735 | u446774692 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['H,W = map(int,input().split())\ns = [input() for _ in range(H)]\nimport math\nDP = [[math.inf]+[0]*W for _ in range(H+1)]\nre = [[0]*(W+1) for _ in range(H+1)]\nDP[0] = [math.inf]*(W+1)\nDP[0][1] = DP[1][0] = 0\n\nfor i in range(1,H+1):\n for j in range(1,W+1):\n if s[i-1][j-1] == ".":\n DP[i][j]... | ['Runtime Error', 'Accepted'] | ['s079853824', 's046023567'] | [3064.0, 3188.0] | [17.0, 28.0] | [742, 487] |
p02735 | u447899880 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['h,w=map(int,input().split())\ns=list()\nfor i in range(h):\n line=str(input())\n s.append(line)\n \nresult=[[0]*w]*h\ndef se(x,y):\n if x==0 and y==0:\n if s[0][0]=="#":\n result[x][y]=1\n else:\n result[x][y]=0\n if x==0:\n if s[x][y-1]!=s[x][y]:\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s804131921', 's860960445', 's850629295'] | [3064.0, 3316.0, 3188.0] | [28.0, 30.0, 29.0] | [958, 1058, 1049] |
p02735 | u450983668 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ["h,w=map(int,input().split())\nc=[[1000]*w]*h\ns=[[+(i=='#') for i in input()] for _ in range(h)]\nc[0][0]=s[0][0]\nfor i in range(h):\n for j in range(w):\n for k,l in [[i-1,j],[i,j-1]]:\n if k<0 or l<0:continue\n if s[i][j]==0:\n c[i][j]=min(c[i][j],c[k][l])\n else:\n if s[k][l]==0:\... | ['Wrong Answer', 'Accepted'] | ['s501680344', 's910789984'] | [3188.0, 3188.0] | [1155.0, 43.0] | [650, 283] |
p02735 | u457901067 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['H,W = list(map(int, input().split()))\nB = []\nfor _ in range(H):\n B.append(input())\n \nA = [[999999 for _ in range(W)] for _ in range(H)]\nA[0][0] = 0 if B[0][0] == "." else 1\n\nfor i in range(H):\n for j in range(W):\n if i+j == 0:\n continue\n X,Y = 999999, 999999\n if i > 0:\n X = A[i-1][... | ['Wrong Answer', 'Accepted'] | ['s119015343', 's739869318'] | [3188.0, 3064.0] | [32.0, 31.0] | [476, 541] |
p02735 | u476604182 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ["H,W,*L = open('0').read().split()\nH,W = map(int, (H,W))\ndp = [[0]*W for i in range(H)]\nif L[0][0]=='#':\n dp[0][0] = 1\nfor i in range(1,H):\n if L[i][0]=='#':\n dp[i][0] = dp[i-1][0]+1\n else:\n dp[i][0] = dp[i-1][0]\nfor j in range(1,W):\n if L[0][j]=='#':\n dp[0][j] = dp[0][j-1]+1\n else:\n dp[... | ['Runtime Error', 'Accepted'] | ['s164006698', 's441358358'] | [3064.0, 3188.0] | [17.0, 29.0] | [507, 734] |
p02735 | u478266845 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['import numpy as np\n\nH,W = [int(i) for i in input().split()]\n\ns=[]\n\nfor i in range(H):\n s.append(str(input()))\n \n# s[i][0] to s[i][W-1] \n\npat_mat=[]\n\nfor i in range(H):\n if i ==0:\n if s[0][0] == ".":\n pat_mat.append([0])\n else:\n pat_mat.append([1])\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s626308428', 's729835500', 's041960644'] | [12404.0, 12644.0, 14436.0] | [165.0, 163.0, 160.0] | [1557, 1557, 1574] |
p02735 | u496815777 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['import numpy\nh, w = map(int, input().split())\ns = [input() for _ in range(h)]\n\ndp = np.zeros(h * w).reshape(h, w)\n\nif s[0][0] == "#":\n dp[0][0] = 1\nelse:\n dp[0][0] = 0\n \nfor i in range(h - 1):\n if s[i + 1][0] == "." or s[i][0] == s[i + 1][0]:\n dp[i + 1][0] = dp[i][0]\n else:\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s044542369', 's449661352', 's700220088'] | [12508.0, 3064.0, 12516.0] | [152.0, 17.0, 186.0] | [1226, 1252, 1684] |
p02735 | u497046426 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ["from itertools import product\nfrom heapq import heappush, heappop\n\nclass Dijkstra:\n def __init__(self, N):\n self.N = N # #vertices\n self.E = [[] for _ in range(N)]\n\n def add_edge(self, init, end, weight, undirected=False):\n self.E[init].append((end, weight))\n if undirected:... | ['Runtime Error', 'Accepted'] | ['s136262450', 's491633230'] | [7156.0, 7284.0] | [59.0, 72.0] | [2025, 2073] |
p02735 | u497952650 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['\ndef ans_dp(H,W,M):\n dp = [[0 for i in range(W)] for j in range(H)]\n flag = [[0 for i in range(W)] for j in range(H)]\n if M[0][0] == "#":\n dp[0][0] = 1\n flag[0][0] = 1\n else:\n dp[0][0] == 0\n for i in range(1,W):\n if M[i][0] == "#":\n flag[i][0] = 1\n ... | ['Runtime Error', 'Accepted'] | ['s589997415', 's554614414'] | [3444.0, 3444.0] | [24.0, 27.0] | [1488, 1278] |
p02735 | u522973286 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ["#!/usr/bin/env python3\n\n\ndef main() -> None:\n H, W = rmi()\n s = []\n for h in range(H):\n line = list(map(lambda c: c == '.', list(r())))\n s.append(line)\n dp = []\n for _ in range(H):\n dp.append([-1] * W)\n dp[0][0] = 0 if s[0][0] else 1\n for h in range(1, H):\n ... | ['Runtime Error', 'Accepted'] | ['s633280555', 's977653575'] | [3316.0, 3316.0] | [24.0, 29.0] | [1025, 1127] |
p02735 | u533885955 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['#A\nH,W = map(int,input().split())\nG = [list(str(input())) for _ in range(H)]\ninf = float("inf")\n\ndist = [[inf for w in range(W)] for h in range(H)]\n\nif G[0][0] == "#":\n dist[0][0] = 1\nelse:\n dist[0][0] = 0\n\nfor i in range(H):\n for j in range(W):\n if i == 0 and j == 0:\n pass\n... | ['Wrong Answer', 'Accepted'] | ['s553904878', 's152528025'] | [3316.0, 3316.0] | [30.0, 29.0] | [875, 875] |
p02735 | u556069480 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['import itertools\n \nH,W=map(int, input().split())\ngarden=[]\n \nfor i in range(H):\n garden.append(list(input().replace(".","1").replace("#","0")))\n \n\ndct=[(1,0),(0,1),(-1,0),(0,-1)]\n\n#H,W=5,5\nstart=(0,0)\ngoal=(H-1,W-1)\npath=[start]\nd=[ [i+j for i in range(W)] for j in range(H)]\n#print(d)\ndone=[(0,0)]... | ['Runtime Error', 'Accepted'] | ['s848740889', 's895782578'] | [3064.0, 3316.0] | [17.0, 46.0] | [2188, 662] |
p02735 | u579699847 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ["import bisect,collections,copy,itertools,math,string\ndef I(): return int(input())\ndef S(): return input()\ndef LI(): return list(map(int,input().split()))\ndef LS(): return list(input().split())\n##################################################\nH,W = LI()\nS = [S() for _ in range(H)]\ndp = [[-1]*W for _ in range... | ['Wrong Answer', 'Accepted'] | ['s184345751', 's113706419'] | [3952.0, 3188.0] | [35.0, 33.0] | [730, 766] |
p02735 | u651109406 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ["h, w = map(int, input().split())\ns = [] # h, w\nfor i in range(h):\n s += [','.join(input()).split(',')]\n\ncost = [[1 if s[0][0] == '#' else 0 for i in range(h + 1)] for j in range(w + 1)]\n\nfor i in range(1, h + w - 1):\n for j in range(w if h < w else h):\n if j < h and i - j < w and j >= 0 and i - ... | ['Runtime Error', 'Accepted'] | ['s011473121', 's970857608'] | [3860.0, 3188.0] | [47.0, 34.0] | [737, 841] |
p02735 | u694665829 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ["h,w=map(int,input().split())\ns=[]\nfor i in range(h):\n s.append(list(input()))\n\n#solution:dp\n\ndp=[[float('inf') for _ in range(w)] for _ in range(h)]\ndp[0][0] = 0 if s[0][0] == '.' else 1\n\ndef update(dp, i, j, ni, nj):\n if s[ni][nj]=='.':\n dp[ni][nj]=min(dp[i][j],dp[ni][nj])\n elif s[i][j]=... | ['Wrong Answer', 'Accepted'] | ['s868826868', 's580093087'] | [9668.0, 9476.0] | [43.0, 41.0] | [589, 579] |
p02735 | u709304134 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ["H, W = map(int,input().split())\nboard = []\nfor h in range(H):\n board.append(input())\n\ndp=[[1000 for i in range(W+1)] for j in range(H+1)]\ndp[0][1] = 0\ndp[1][0] = 0\n\nfor h in range(H):\n for w in range(W):\n dp[h+1][w+1] = min(dp[h][w+1] + (board[h][w]=='#' and (h==0 or board[h-1][w]=='')), dp[h+... | ['Wrong Answer', 'Accepted'] | ['s721614896', 's464278781'] | [3064.0, 3064.0] | [29.0, 30.0] | [403, 405] |
p02735 | u726285999 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['H, W = map(int, input().split())\ntable = []\nfor i in range(H):\n table.append([(True if x == "." else False) for x in list(input())])\n\ncolormap = [[0 for _ in range(W)] for _ in range(H)]\ncolormap[0][0] = 0 if table[0][0] else 1\n\ndef update(i,j):\n\n tmp_A = 200\n tmp_B = 200\n \n if 0 < i < H a... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s134360691', 's753097729', 's419806356'] | [3188.0, 21396.0, 3188.0] | [32.0, 396.0, 33.0] | [906, 186, 1010] |
p02735 | u727148417 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['import numpy as np\n\nH, W = map(int, input().split())\ntemp = [list(input().replace("\nmasu = [[int(temp[i][j]) for j in range(W)] for i in range(H)]\n\n\ndp = np.zeros((H, W))\ndp_flag = np.zeros((H, W))\n\nif masu[0][0] == 0:\n dp[0][0] = 1\nelse:\n dp[0][0] = 0\n\nfor i in range(0,H):\n for j in range(0,... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s158143017', 's178591648', 's218638639', 's322942527', 's576559520', 's669889596', 's739739504', 's745874376', 's083991774'] | [12744.0, 14788.0, 12676.0, 3192.0, 14584.0, 21984.0, 2940.0, 12664.0, 12452.0] | [230.0, 224.0, 196.0, 18.0, 207.0, 570.0, 17.0, 199.0, 161.0] | [1095, 1114, 697, 1580, 807, 1177, 489, 764, 864] |
p02735 | u728483880 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['H,W=map(int,input().split())\n\na=[[0]*W for i in range(H)]\nb=[[0]*W for i in range(H)]\n\n\nfor i in range(H):\n\ta[i]=input().split(",")\n\nfor j in range(1,W):\n\tb[0][j]=b[0][j-1]+int(not(a[0][j]==a[0][j-1]))\n\nfor i in range(1,H):\n\tb[i][0]=b[i-1][0]+int(not(a[i-1][0]==a[i][0]))\n\tfor j in range(1,W):\n\t\tb... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s682142225', 's817330309', 's377689175'] | [3188.0, 3316.0, 3316.0] | [18.0, 29.0, 28.0] | [408, 429, 609] |
p02735 | u745514010 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['h, w = map(int, input().split())\ns = []\nfor _ in range(h):\n s.append(list(input()))\n\nbefore = s[0][0]\nans = [[0 for i in range(w)] for j in range(h)]\nfor i, row in enumerate(s):\n for j, index in enumerate(row):\n if i == j == 0:\n if before == "#":\n ans[i][j] = 1\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s018637347', 's961296036', 's793052770'] | [3316.0, 3064.0, 3316.0] | [30.0, 26.0, 30.0] | [993, 574, 968] |
p02735 | u750651325 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['import sys\nsys.stdin.readline\n\nH, W = map(int, input().split())\nboard = [[[0,1][a == "#"] for a in input()] for i in range(H)]\nY = [[0]*W for _ in range(H)]\n\nfor i in range(H):\n for j in range(W):\n a = []\n if j == 0:\n pass\n else:\n if board[i][j-1] == False an... | ['Wrong Answer', 'Accepted'] | ['s348391428', 's555685168'] | [9552.0, 9388.0] | [34.0, 35.0] | [728, 797] |
p02735 | u780962115 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['##!/usr/bin/env python\n## -*- coding: utf-8 -*-\n#import sys\n#import os\n#f = open(\'input.txt\', \'r\')\n\n#input = sys.stdin.readline\n\n\nh, w = map(int, input().split())\n\ndp = [[0 for i in range(w)] for j in range(h)]\n\nmaze = []\nfor i in range(h):\n sub = list(input())[:-1]\n maze.append(sub)\n\nif m... | ['Runtime Error', 'Accepted'] | ['s876878881', 's940845406'] | [3188.0, 3316.0] | [18.0, 29.0] | [979, 974] |
p02735 | u798818115 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['# coding: utf-8\n# Your code here!\nH,W=map(int,input().split())\n\nmeizu=[]\nfor _ in range(H):\n meizu.append(list(input()))\n\ndp=[[10**9 for w in range(W)] for h in range(H)]\ndp[0][0]=1 if meizu[0][0]=="#" else 0\n\nfor h in range(H):\n for w in range(W):\n if h!=H-1:\n dp[h+1][w]=min(dp[... | ['Wrong Answer', 'Time Limit Exceeded', 'Accepted'] | ['s776600802', 's830066742', 's540829743'] | [3188.0, 4844.0, 3188.0] | [32.0, 2108.0, 33.0] | [488, 528, 530] |
p02735 | u801049006 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ["H, W = map(int, input().split())\ns = [list(input()) for _ in range(H)]\n\ndp = [1000 for _ in range(W+1) for _ in range(H+1)]\ndp[0][1] = 0\ndp[1][0] = 0\n\nfor y in range(W):\n for x in range(H):\n dp[y+1][x+1] = min(\n dp[y][x+1] + (s[y][x] == '#' and (y == 0 or s[y-1][x] == '.')),\n ... | ['Runtime Error', 'Accepted'] | ['s561986972', 's960673294'] | [3188.0, 3188.0] | [19.0, 37.0] | [401, 565] |
p02735 | u810787773 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['H,W = map(int,input().split())\nmap = []\nINF = 10**8\nfor _ in range(H):\n map.append(input())\n\ndp = [[0 for i in range(W)] for i in range(H)]\n\nfor i in range(H):\n for j in range(W):\n if i == 0 and j == 0:\n if map[i][j] == \'#\':\n dp[i][j] = 1\n elif i == 0:\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s255557102', 's347494737', 's419980332'] | [9332.0, 9360.0, 9284.0] | [27.0, 39.0, 39.0] | [911, 911, 911] |
p02735 | u811817592 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['# -*- coding: utf-8 -*-\nH, W = map(int, input().split())\nHW_list = []\n\nfor i in range(H):\n HW_list.append(str(input()))\n\ndp = [[H * W] * H] * W\n\ndp[0][0] = 0\nfor i in range(H):\n for j in range(W):\n if i == 0 and j == 0:\n continue\n if i == 0:\n min_num_h = H * W\... | ['Runtime Error', 'Accepted'] | ['s198987723', 's371529816'] | [3064.0, 3064.0] | [29.0, 29.0] | [692, 699] |
p02735 | u830054172 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['h, w = map(int, input().split())\ns = []\nfor _ in range(h):\n s.append(input())\n\ndp = [[h*w for i in range(w+1)] for j in range(h+1)]\n\ndp[0][1] = 0\ndp[1][0] = 0\n\nfor i in range(h):\n for j in range(w):\n print("i", i, "j", j, "s[i][j]", s[i][j])\n print(s[i][j] == \'#\' and (i == 0 or s[i-... | ['Wrong Answer', 'Accepted'] | ['s269350309', 's310532909'] | [4100.0, 3444.0] | [67.0, 30.0] | [722, 726] |
p02735 | u851469594 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ["import copy\nimport heapq\nH, W = map(int, input().split())\nS = []\ncnt_list = []\nfor _ in range(H):\n S.append(list(input()))\n\ndef move(i,j,cnt,frag):\n c_cnt = copy.deepcopy(cnt)\n c_frag = copy.deepcopy(frag)\n if frag != S[i][j]:\n c_cnt = cnt + 1\n c_frag = S[i][j]\n if i != H-1:\n ... | ['Wrong Answer', 'Accepted'] | ['s022648402', 's620392526'] | [4804.0, 3700.0] | [2104.0, 33.0] | [613, 605] |
p02735 | u852210959 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ["# -*- coding: utf-8 -*-\nimport itertools\n\n\ndef change(val):\n \n if val == '#':\n return 1\n\n \n return 0\n\n\n\n\n\ndef main():\n h, w = map(int, input().split())\n board = [[change(s) for s in input()] for i in range(h)]\n\n cnt = 200\n for move in itertools.product(range(0, 2), ... | ['Wrong Answer', 'Accepted'] | ['s895776146', 's694420733'] | [3188.0, 3316.0] | [2104.0, 29.0] | [1479, 1205] |
p02735 | u865298224 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['H, W = map(int, input().split())\n\nS = [""] * H\n\nfor i in range(H):\n S[i] = input()\n\ndist = [[1000000 for i in range(W)] for j in range(H)]\n\ndist[0][0] = 0 if S[0][0] == "." else 1\n\nfor i in range(H):\n for j in range(W):\n if i > 0:\n if S[i][j] == "#":\n dist[i][j] =... | ['Wrong Answer', 'Accepted'] | ['s015722889', 's367740869'] | [3316.0, 3188.0] | [33.0, 33.0] | [779, 767] |
p02735 | u871841829 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ["H,W = map(int, input().split())\ng = []\nfor _ in range(H):\n g.append(list(input()))\n\ndp = [[10**9 for _ in range(W)] for __ in range(H)]\n\n#solve\ndef dfs(i, j, score, lc):\n if i < H and i >= 0 and j < W and j >= 0:\n if lc == '.' and g[i][j] == '#':\n score += 1\n dp[i][j] = min(... | ['Wrong Answer', 'Accepted'] | ['s257862522', 's577674815'] | [9232.0, 9348.0] | [2206.0, 47.0] | [456, 554] |
p02735 | u879309973 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['INF = 10**9\ndef solve(h, w, s):\n dp = [[INF] * w for r in range(h)]\n dp[0][0] = int(s[0][0] == "#")\n for r in range(h):\n for c in range(w): \n for dr, dc in [(-1, 0), (0, -1)]:\n nr, nc = r+dr, c+dc\n if (0 <= nr < h) and (0 <= nc < w):\n ... | ['Wrong Answer', 'Accepted'] | ['s103005717', 's123204366'] | [9296.0, 9236.0] | [38.0, 40.0] | [484, 495] |
p02735 | u905203728 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['h,w=map(int,input().split())\nD=[[0]*w for _ in range(h)]\n\nS=[list(input()) for _ in range(h)]\nfor i in range(h):\n for j in range(w):\n for x,y in ((1,0),(0,1)):\n X,Y=i+x,j+y\n if 0<=X<=h and 0<=Y<=w:\n if S[i][j]=="." and S[X][Y]=="#":\n D[X][Y]=... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s145360576', 's556123418', 's583830116', 's815434340', 's626166363'] | [3316.0, 3188.0, 3188.0, 3188.0, 3188.0] | [28.0, 35.0, 28.0, 32.0, 39.0] | [372, 391, 392, 370, 481] |
p02735 | u906501980 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['h, w = map(int, input().split())\nS = [list(input()) for _ in range(h)]\ninf = 10*3\ndp = [[inf]*w for _ in range(h)]\n\ndp[0][0] = int(S[0][0]=="#")\nfor i in range(1, w):\n dp[0][i] = dp[0][i-1] + (S[0][i-1]!=S[0][i])\nfor i in range(1, h):\n dp[i][0] = dp[i-1][0] + (S[i-1][0]!=S[i][0])\nfor i in range(1, h):... | ['Wrong Answer', 'Accepted'] | ['s777422059', 's254089707'] | [3188.0, 3188.0] | [26.0, 30.0] | [441, 509] |
p02735 | u918935103 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['from collections import deque\nh,w = map(int,input().split())\ns = []\nfor i in range(h):\n s0 = list(input())\n s.append(s0)\nd = deque()\nrl = [[h*w+1 for i in range(w)] for i in range(h)]\nif s[0][0] == ".":\n d.append([0,0])\n rl[0][0] = 0\nelse:\n d.append([0,0])\n rl[0][0] = 1\nwhile len(d):\n... | ['Runtime Error', 'Accepted'] | ['s014529548', 's517989969'] | [135188.0, 3800.0] | [2036.0, 44.0] | [2096, 3375] |
p02735 | u935558307 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['import sys\nimport heapq\n\nH,W = map(int,input().split())\nmaze = [list(input()) for i in range(H)]\n\ndef removeWalls(wallPointH,wallPointW):\n if maze[wallPointH][wallPointW]=="#":\n changeTo = "."\n elif maze[wallPointH][wallPointW]=="1":\n changeTo = "0"\n if maze[wallPointH][wallPointW]=="#" or maze[wa... | ['Wrong Answer', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted'] | ['s005324533', 's126726472', 's313858545', 's369940137', 's490917807'] | [66036.0, 14708.0, 69364.0, 14580.0, 3316.0] | [2108.0, 2104.0, 2108.0, 2104.0, 47.0] | [2050, 1603, 1177, 1101, 1640] |
p02735 | u987164499 | 2,000 | 1,048,576 | Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white. The grid is said to be _good_ if and only if the following condition is satisfied: * From (1, 1), we can reach (H, W) by moving on... | ['from sys import stdin,setrecursionlimit\nsetrecursionlimit(10**6) \nh,w = map(int,stdin.readline().rstrip().split())\nli = [stdin.readline().rstrip() for _ in range(h)]\ninf = 10**10\nlin = [[0 for i in range(w)]for j in range(h)]\nfor i in range(h):\n for j in range(w):\n if li[i][j] == "#":\n l... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s080400209', 's841444620', 's930310604', 's988167564', 's135883933'] | [3064.0, 3560.0, 3188.0, 2940.0, 4080.0] | [28.0, 92.0, 32.0, 17.0, 55.0] | [593, 486, 826, 8, 916] |
p02736 | u021548497 | 2,000 | 1,048,576 | Given is a sequence of N digits a_1a_2\ldots a_N, where each element is 1, 2, or 3. Let x_{i,j} defined as follows: * x_{1,j} := a_j \quad (1 \leq j \leq N) * x_{i,j} := | x_{i-1,j} - x_{i-1,j+1} | \quad (2 \leq i \leq N and 1 \leq j \leq N+1-i) Find x_{N,1}. | ['import sys\nn = int(input())\na = input()\nif n == 2:\n print(abs(int(a[0]-int(a[1]))))\n sys.exit()\n\nkey = [0]*(n-1)\njudge = False\nfor i in range(n-1):\n key[i] = abs(int(a[i])-int(a[i+1]))\n if key[i] == 1:\n judge = True\n\ncomb = 1\nans = 0\nfor i in range(n-1):\n ans += comb*key[i]\n ans %= 2\n com... | ['Runtime Error', 'Accepted'] | ['s808085853', 's412503034'] | [12572.0, 58056.0] | [1993.0, 603.0] | [389, 992] |
p02736 | u203843959 | 2,000 | 1,048,576 | Given is a sequence of N digits a_1a_2\ldots a_N, where each element is 1, 2, or 3. Let x_{i,j} defined as follows: * x_{1,j} := a_j \quad (1 \leq j \leq N) * x_{i,j} := | x_{i-1,j} - x_{i-1,j+1} | \quad (2 \leq i \leq N and 1 \leq j \leq N+1-i) Find x_{N,1}. | ['print(0)', 'print(2)', 'N=int(input())\nslist=input()\n\ndef fact_mod2(n,r):\n if n==(r|(n-r)):\n return 1\n else:\n return 0\n\nalist=[]\nfor s in slist:\n alist.append(int(s)-1) \n#print(alist)\n\nparity=0\nfor i in range(N):\n parity+=fact_mod2(N-1,i)*alist[i]\n#print(parity)\n\nif parity%2==1:\n print... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s012019688', 's209157940', 's891116180'] | [2940.0, 2940.0, 13624.0] | [18.0, 17.0, 1193.0] | [8, 8, 504] |
p02736 | u218843509 | 2,000 | 1,048,576 | Given is a sequence of N digits a_1a_2\ldots a_N, where each element is 1, 2, or 3. Let x_{i,j} defined as follows: * x_{1,j} := a_j \quad (1 \leq j \leq N) * x_{i,j} := | x_{i-1,j} - x_{i-1,j+1} | \quad (2 \leq i \leq N and 1 \leq j \leq N+1-i) Find x_{N,1}. | ['n = int(input())\nb = input()\ntwo = True\nif "2" in b:\n\ttwo = False\nans = 0\na = ""\nfor i in range(n):\n\tif b[i] != "1":\n\t\tans ^= ((n-1) == ( i | (n-1 - i)))\nif ans:\n\tif two:\n\t\tprint(2)\n\telse:\n\t\tprint(1)\nelse:\n\tprint(0)\n', 'n = int(input())\na = input()\n\nif "2" in a:\n\tans = 0\n\tfor i in r... | ['Wrong Answer', 'Accepted'] | ['s269664060', 's190404848'] | [5132.0, 5612.0] | [483.0, 476.0] | [216, 295] |
p02736 | u227082700 | 2,000 | 1,048,576 | Given is a sequence of N digits a_1a_2\ldots a_N, where each element is 1, 2, or 3. Let x_{i,j} defined as follows: * x_{1,j} := a_j \quad (1 \leq j \leq N) * x_{i,j} := | x_{i-1,j} - x_{i-1,j+1} | \quad (2 \leq i \leq N and 1 \leq j \leq N+1-i) Find x_{N,1}. | ['n=int(input())\ns=input()\nif set(list(s))=={"1","3"}:print(2)', 'n=int(input())\ns=input()\nif set(list(s))=={"1","3"}:print(0)\n', 'from random import randint\nn=int(input())\ns=input()\nif set(list(s))=={"1","3"}:print(randint(0,1)*2)\nelse:print(randint(0,1))', 'from random import randint\nprint(randint(0,2))', '... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s274619050', 's345280471', 's373044893', 's399216119', 's568587002', 's689387361', 's529973265'] | [12864.0, 12908.0, 12624.0, 4208.0, 2940.0, 3068.0, 32096.0] | [47.0, 46.0, 52.0, 33.0, 18.0, 17.0, 583.0] | [60, 61, 125, 46, 8, 8, 502] |
p02736 | u268554510 | 2,000 | 1,048,576 | Given is a sequence of N digits a_1a_2\ldots a_N, where each element is 1, 2, or 3. Let x_{i,j} defined as follows: * x_{1,j} := a_j \quad (1 \leq j \leq N) * x_{i,j} := | x_{i-1,j} - x_{i-1,j+1} | \quad (2 \leq i \leq N and 1 \leq j \leq N+1-i) Find x_{N,1}. | ['N = int(input())\na = list(map(int,list(input())))\na = list(map(lambda x:x-1,a))\nx = 0\nnum_mod = [0]*N\nfor i in range(1,N):\n tmp = 0\n while i%2==0:\n i//=2\n tmp+=1\n num_mod[i] = num_mod[i-1]+tmp\n \n\nfor i,n in enumerate(a):\n if n%2==0:\n continue\n else:\n if num_mod[N-1]==(num_mod[i]+num... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s096357437', 's351337889', 's547001971', 's028667694'] | [28700.0, 28756.0, 21092.0, 58228.0] | [1417.0, 1476.0, 537.0, 1493.0] | [594, 588, 226, 600] |
p02736 | u377370946 | 2,000 | 1,048,576 | Given is a sequence of N digits a_1a_2\ldots a_N, where each element is 1, 2, or 3. Let x_{i,j} defined as follows: * x_{1,j} := a_j \quad (1 \leq j \leq N) * x_{i,j} := | x_{i-1,j} - x_{i-1,j+1} | \quad (2 \leq i \leq N and 1 \leq j \leq N+1-i) Find x_{N,1}. | ['n = int(input())\na = input()\nx = []\nx.extend([int(i) for i in a])\n\nif len(x) > 1:\n x = [abs(x[i] - x[i + 1]) for i in range(len(x) - 1)]\n\n\n\n\n\nif 1 in x:\n flag = True\n x = [1 if i == 1 else 0 for i in x]\nelse:\n flag = False\n x = [1 if i == 2 else 0 for i in x]\nc=0\nn=len(x)\nn_b=bin(n)... | ['Runtime Error', 'Accepted'] | ['s980394037', 's212180310'] | [23856.0, 22460.0] | [420.0, 752.0] | [710, 763] |
p02736 | u392319141 | 2,000 | 1,048,576 | Given is a sequence of N digits a_1a_2\ldots a_N, where each element is 1, 2, or 3. Let x_{i,j} defined as follows: * x_{1,j} := a_j \quad (1 \leq j \leq N) * x_{i,j} := | x_{i-1,j} - x_{i-1,j+1} | \quad (2 \leq i \leq N and 1 \leq j \leq N+1-i) Find x_{N,1}. | ['import random\nprint(random.randint() % 2)', 'import random\nprint(random.randint() % 2)', 'N = int(input())\nA = list(map(int, input()))\nA = [abs(A[i] - A[i + 1]) % 2 for i in range(len(A) - 1)]\n\ncnt = 0\nfor i in range(len(A)):\n if A[i: i + 3] == [0, 1, 0]:\n cnt += 1\n\nprint(cnt % 2)', 'import rando... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s093978274', 's195569589', 's261004674', 's294270876', 's469759540', 's483840155', 's509546113', 's560303835', 's702642939', 's865071985', 's206396436'] | [3316.0, 4208.0, 20460.0, 3444.0, 20464.0, 20464.0, 20460.0, 20460.0, 3064.0, 20460.0, 20460.0] | [26.0, 34.0, 734.0, 23.0, 707.0, 388.0, 379.0, 372.0, 19.0, 398.0, 551.0] | [41, 41, 201, 45, 201, 122, 136, 139, 8, 144, 237] |
p02736 | u520276780 | 2,000 | 1,048,576 | Given is a sequence of N digits a_1a_2\ldots a_N, where each element is 1, 2, or 3. Let x_{i,j} defined as follows: * x_{1,j} := a_j \quad (1 \leq j \leq N) * x_{i,j} := | x_{i-1,j} - x_{i-1,j+1} | \quad (2 \leq i \leq N and 1 \leq j \leq N+1-i) Find x_{N,1}. | ['\n\n\nimport numpy as np\nn=int(input())\na_ = list(map(int, list(input())))\na = np.array(a_)-1\ndiv2=[0]\ncnt=0\nex1 = False\n\nif 1 in a:\n ex1 = True\nelse:\n a//=2\ntst=1\ntsts=[1]\nfor i in range(n-1):\n p=int(((n-1)&i)==i)\n div2.append(p)\ndiv2=np.array(div2)\ndv2=1-(div2>0)\ntmp= (a*dv2).sum()%2\... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s149793675', 's779553779', 's997371096', 's176383368'] | [52492.0, 29984.0, 44436.0, 64692.0] | [870.0, 291.0, 863.0, 1880.0] | [542, 462, 449, 622] |
p02736 | u561231954 | 2,000 | 1,048,576 | Given is a sequence of N digits a_1a_2\ldots a_N, where each element is 1, 2, or 3. Let x_{i,j} defined as follows: * x_{1,j} := a_j \quad (1 \leq j \leq N) * x_{i,j} := | x_{i-1,j} - x_{i-1,j+1} | \quad (2 \leq i \leq N and 1 \leq j \leq N+1-i) Find x_{N,1}. | ["import sys\nINF = 10 ** 9\nMOD = 10 ** 9 + 7\nfrom collections import deque\nsys.setrecursionlimit(100000000)\n\ndef main():\n n = int(input())\n a = list(input())\n print(0)\nif __name__=='__main__':\n main()\n\n", "import sys\nINF = 10 ** 9\nMOD = 10 ** 9 + 7\nfrom collections import deque\nsys.setrecur... | ['Wrong Answer', 'Accepted'] | ['s302186925', 's588373019'] | [13116.0, 31092.0] | [34.0, 786.0] | [212, 771] |
p02736 | u693378622 | 2,000 | 1,048,576 | Given is a sequence of N digits a_1a_2\ldots a_N, where each element is 1, 2, or 3. Let x_{i,j} defined as follows: * x_{1,j} := a_j \quad (1 \leq j \leq N) * x_{i,j} := | x_{i-1,j} - x_{i-1,j+1} | \quad (2 \leq i \leq N and 1 \leq j \leq N+1-i) Find x_{N,1}. | ['N=int(input())\nA=[int(a)-1 for a in input()]\nr=1-(1 in A)\nprint(sum([A[i]&r and (N-1&i)==i for i in range(N)])%2*r)', 'N=int(input())\nA=[int(a)-1 for a in input()]\nr=2-(1 in A)\nprint(sum([A[i]&r and (N-1&i)==i for i in range(N)])%2*r)'] | ['Wrong Answer', 'Accepted'] | ['s162435559', 's571905994'] | [20460.0, 20460.0] | [345.0, 429.0] | [115, 115] |
p02736 | u801570811 | 2,000 | 1,048,576 | Given is a sequence of N digits a_1a_2\ldots a_N, where each element is 1, 2, or 3. Let x_{i,j} defined as follows: * x_{1,j} := a_j \quad (1 \leq j \leq N) * x_{i,j} := | x_{i-1,j} - x_{i-1,j+1} | \quad (2 \leq i \leq N and 1 \leq j \leq N+1-i) Find x_{N,1}. | ['n = int(input())\na = list(map(int,input().split()))\n\nwhile n != 0:\n\tx = 1\n\twhile x < n // 2:\n\t\tx *= 2\n\tb = []\n\tfor i in range(x, n):\n\t\tb.append(abs(a[i - x] - a[i]))\n\ta = b\n\tn -= digit\n\tif len(b) == 1:\n\t\tbreak\nprint(a[0])\n', 'N = int(input())\na = list(map(int, list(input())))\n \nwhile N ... | ['Runtime Error', 'Accepted'] | ['s696510611', 's684411420'] | [5132.0, 21348.0] | [2104.0, 374.0] | [222, 247] |
p02736 | u837673618 | 2,000 | 1,048,576 | Given is a sequence of N digits a_1a_2\ldots a_N, where each element is 1, 2, or 3. Let x_{i,j} defined as follows: * x_{1,j} := a_j \quad (1 \leq j \leq N) * x_{i,j} := | x_{i-1,j} - x_{i-1,j+1} | \quad (2 \leq i \leq N and 1 \leq j \leq N+1-i) Find x_{N,1}. | ['import sys\n\nN = int(input()) - 1\ntwo = False\nS = 0\nfor i, a in zip(range(N+1), sys.stdin):\n a = int(a)\n if not two:\n two = a == 2\n if i & N == i:\n S ^= a-1\n\nif two:\n S &= ~2\n\nprint(S)\n', 'import sys\n\nN = int(input()) - 1\ntwo = False\nS = 0\nfor i in range(N+1):\n a = int(sys.stdin.read(1... | ['Wrong Answer', 'Accepted'] | ['s300674958', 's112489005'] | [4980.0, 3060.0] | [2108.0, 566.0] | [194, 191] |
p02737 | u837673618 | 2,000 | 1,048,576 | Given are simple undirected graphs X, Y, Z, with N vertices each and M_1, M_2, M_3 edges, respectively. The vertices in X, Y, Z are respectively called x_1, x_2, \dots, x_N, y_1, y_2, \dots, y_N, z_1, z_2, \dots, z_N. The edges in X, Y, Z are respectively (x_{a_i}, x_{b_i}), (y_{c_i}, y_{d_i}), (z_{e_i}, z_{f_i}). Bas... | ['from collections import defaultdict\n\nM = 998244353\nB = pow(10, 18, M)\nN = int(input())\n\ndef ext_euc(a, b):\n x1, y1, z1 = 1, 0, a\n x2, y2, z2 = 0, 1, b\n while z1 != 1:\n d, m = divmod(z2,z1)\n x1, x2 = x2-d*x1, x1\n y1, y2 = y2-d*y1, y1\n z1, z2 = m, z1\n return x1, y1\n\ndef inv_mod(a, b, m):... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s220260337', 's309892359', 's623791211', 's740135734', 's780135605', 's866701709', 's960391324', 's989867155'] | [3064.0, 73404.0, 60648.0, 61280.0, 7432.0, 68568.0, 62564.0, 70288.0] | [17.0, 1401.0, 1248.0, 927.0, 40.0, 1335.0, 1943.0, 1274.0] | [1228, 1229, 1356, 1400, 1397, 1625, 1892, 1399] |
p02738 | u423585790 | 6,000 | 1,048,576 | Given is a positive integer N. Find the number of permutations (P_1,P_2,\cdots,P_{3N}) of (1,2,\cdots,3N) that can be generated through the procedure below. This number can be enormous, so print it modulo a prime number M. * Make N sequences A_1,A_2,\cdots,A_N of length 3 each, using each of the integers 1 through 3... | ['from numpy import*\nn,M=map(int,input().split())\nl=n*3+1\nd=zeros((l,n*5))\nd[0][0]=1\nfor i in range(1,l):j,k=i-1,i-2;d[i]=(d[i-3]*k*j+roll(d[k],-1)*j+roll(d[j],1))%M\nprint(sum(d[-1][:l])%M)\n', 'import numpy as p\nn,M=map(int,input().split())\nl=n*3+1\nd=p.zeros((l,n*5),p.int64)\nd[0][0]=d[1][1]=d[2][2]=d[2][-1]=... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s102570766', 's116652558', 's590033247', 's600479045', 's928009385', 's659257359'] | [481516.0, 14556.0, 481492.0, 12488.0, 14428.0, 481520.0] | [3623.0, 152.0, 2691.0, 148.0, 147.0, 2584.0] | [188, 233, 199, 186, 234, 193] |
p02738 | u837673618 | 6,000 | 1,048,576 | Given is a positive integer N. Find the number of permutations (P_1,P_2,\cdots,P_{3N}) of (1,2,\cdots,3N) that can be generated through the procedure below. This number can be enormous, so print it modulo a prime number M. * Make N sequences A_1,A_2,\cdots,A_N of length 3 each, using each of the integers 1 through 3... | ['\u3000from functools import lru_cache, reduce\nfrom itertools import accumulate\n\nN, M = map(int, input().split())\n\n@lru_cache(maxsize=None)\ndef mod_inv(x):\n x1, y1, z1 = 1, 0, x\n x2, y2, z2 = 0, 1, M\n while z1 != 1:\n d, m = divmod(z2, z1)\n x1, x2 = x2-d*x1, x1\n y1, y2 = y2-d*y1, y1\n z1, z2 ... | ['Runtime Error', 'Accepted'] | ['s609956452', 's189751471'] | [3188.0, 3808.0] | [18.0, 2549.0] | [871, 814] |
p02753 | u001495709 | 2,000 | 1,048,576 | In AtCoder City, there are three stations numbered 1, 2, and 3. Each of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates Station i. To improve t... | ["s = input()\nif s[0] == s[1] and s[1] == s[2]:\n print('Yes')\nelse :\n print('No')", "s = input()\nif s[0] == s[1] and s[1] == s[2]:\n print('No')\nelse :\n print('Yes')"] | ['Wrong Answer', 'Accepted'] | ['s233995162', 's028268059'] | [2940.0, 2940.0] | [18.0, 17.0] | [81, 81] |
p02753 | u004823354 | 2,000 | 1,048,576 | In AtCoder City, there are three stations numbered 1, 2, and 3. Each of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates Station i. To improve t... | ['S = list(input())\nif S[0]== S[1] == S[2]:\n print("No")\nelse:\n print("Yes")', "s = list(input())\nif s[0] == s[1] == s[2]:\n print('No')\nelse:\n print('Yes')"] | ['Runtime Error', 'Accepted'] | ['s167328630', 's367356826'] | [8928.0, 9028.0] | [28.0, 26.0] | [84, 81] |
p02753 | u006817280 | 2,000 | 1,048,576 | In AtCoder City, there are three stations numbered 1, 2, and 3. Each of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates Station i. To improve t... | ['\nimport collections\n\n\nclass Solution:\n def solve(self, string):\n counts = collections.Counter(string)\n return counts["A"] > 0 and counts["B"] > 0\n\n\nsol = Solution()\n\nstring = input().strip()\n\nprint(sol.solve(string))\n', '\nimport collections\n\n\nclass Solution:\n def solve(self, st... | ['Wrong Answer', 'Accepted'] | ['s007396159', 's655688935'] | [3444.0, 3316.0] | [83.0, 21.0] | [234, 246] |
p02753 | u006880673 | 2,000 | 1,048,576 | In AtCoder City, there are three stations numbered 1, 2, and 3. Each of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates Station i. To improve t... | ["s = input()\n\nif s == 'AAA' or 'BBB':\n print('No')\nelse:\n print('Yes')", "s = input()\n\nif s == 'AAA' or 'BBB':\n print('No')\nelse:\n print('Yes')", "s = input()\n\nif s = 'AAA' or 'BBB':\n print('No')\nelse:\n print('Yes')", "s = input()\n\nif s == 'AAA' or s == 'BBB':\n print('No')\nelse:... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s221633656', 's478619342', 's526157793', 's874626548'] | [2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 17.0] | [75, 75, 74, 80] |
p02753 | u007738720 | 2,000 | 1,048,576 | In AtCoder City, there are three stations numbered 1, 2, and 3. Each of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates Station i. To improve t... | ['S = input()\nif S == "AAA" or S == "BBB":\n print("Yes")\nelse:\n print(\'No\')', "S=input()\nif S[0] in S[1] in S[2]:\n print('Yes')\nelse:\n print('No')", "S=input()\nif S[0] == S[1] == S[2]:\n print('Yes')\nelse:\n print('No')", "S=input()\nif S[0] in S[1] in S[2]:\n print('Yes')\nelse:\n print('No')", 's ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s435306937', 's466339485', 's913243169', 's914444369', 's668480964'] | [2940.0, 2940.0, 2940.0, 3064.0, 3064.0] | [18.0, 17.0, 17.0, 17.0, 17.0] | [75, 69, 69, 69, 77] |
p02753 | u010439424 | 2,000 | 1,048,576 | In AtCoder City, there are three stations numbered 1, 2, and 3. Each of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates Station i. To improve t... | ['s = input()\nif \'A\' in s and \'B\' in s:\n print("YES")\nelse:\n print("NO")\n', 's = input()\nif \'A\' in s and \'B\' in s:\n print("Yes")\nelse:\n print("No")\n'] | ['Wrong Answer', 'Accepted'] | ['s155102201', 's917282211'] | [2940.0, 2940.0] | [17.0, 17.0] | [77, 77] |
p02753 | u011277545 | 2,000 | 1,048,576 | In AtCoder City, there are three stations numbered 1, 2, and 3. Each of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates Station i. To improve t... | ['n=input()\n\nif n="AAA" or n="BBB":\n print("No")\nelse:\n print("Yes")', 'S=input()\nif S=="AAA" or S=="BBB":\n print("No")\nelse:\n print("No")', 'n=input()\n\nif n=="AAA" or n=="BBB":\n print("Yes")\nelse:\n print("No")', 'S=input()\nif S=="AAA" or S=="BBB":\n print("No")\nelse:\n print("Yes")'] | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s059546653', 's348497668', 's811975488', 's167277754'] | [2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 17.0] | [68, 72, 70, 73] |
p02753 | u013202780 | 2,000 | 1,048,576 | In AtCoder City, there are three stations numbered 1, 2, and 3. Each of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates Station i. To improve t... | ['s=input()\nprint("YNeos"[s != len(s) * s[0]::2])', 's=input()\nprint("YNeos"[s == len(s) * s[0]::2])'] | ['Wrong Answer', 'Accepted'] | ['s745565790', 's024465025'] | [9032.0, 8960.0] | [26.0, 27.0] | [47, 47] |
p02753 | u015418292 | 2,000 | 1,048,576 | In AtCoder City, there are three stations numbered 1, 2, and 3. Each of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates Station i. To improve t... | ['s = input()\n\nif s[0] == s[1] == s[2]:\n print("Yes")\nelse:\n print("No")\n', 's = input()\n\nif s[0] == s[1] == s[2]:\n print("No")\nelse:\n print("Yes")\n'] | ['Wrong Answer', 'Accepted'] | ['s023873976', 's066965902'] | [2940.0, 2940.0] | [17.0, 17.0] | [77, 77] |
p02753 | u015993380 | 2,000 | 1,048,576 | In AtCoder City, there are three stations numbered 1, 2, and 3. Each of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates Station i. To improve t... | ["print('Yes' if all(input().count(c) > 0 for c in 'AB') else 'No')", "s = input()\nprint('No' if (s == 'AAA' or s == 'BBB') else 'Yes')"] | ['Runtime Error', 'Accepted'] | ['s688861324', 's345363715'] | [2940.0, 2940.0] | [18.0, 17.0] | [65, 64] |
p02753 | u016182925 | 2,000 | 1,048,576 | In AtCoder City, there are three stations numbered 1, 2, and 3. Each of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates Station i. To improve t... | ['S = input()\nS_list = [S]\nif S_list[1] = S_list[2] = S_list[3] :\n print("No")\nelse :\n print("Yes")\n\t', 'S = input()\nS_list = [S]\nif S_list[1] == S_list[2] == S_list[3] :\n print("No")\nelse :\n print("Yes")\n\t', 'S = input()\nif S[0] == S[1] == S[2] :\n print("No")\nelse :\n print("Yes")\n\t'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s355387086', 's402369225', 's071894394'] | [2940.0, 2940.0, 2940.0] | [18.0, 17.0, 17.0] | [101, 103, 75] |
p02753 | u017050982 | 2,000 | 1,048,576 | In AtCoder City, there are three stations numbered 1, 2, and 3. Each of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates Station i. To improve t... | ['a = input()\nif a = "AAA" or a = "BBB":\n print("No")\nelse:\n print("Yes")', 'a = input()\nif a == "AAA" or a == "BBB":\n print("No")\nelse:\n print("Yes")'] | ['Runtime Error', 'Accepted'] | ['s625985118', 's375252500'] | [2940.0, 2940.0] | [17.0, 17.0] | [73, 75] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.