message
stringlengths
2
19.9k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
322
108k
cluster
float64
15
15
__index_level_0__
int64
644
217k
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Once Volodya was at the museum and saw a regular chessboard as a museum piece. And there were only four chess pieces on it: two white rooks, a white king and a black king. "Aha, blacks certainly...
instruction
0
100,691
15
201,382
No
output
1
100,691
15
201,383
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Once Volodya was at the museum and saw a regular chessboard as a museum piece. And there were only four chess pieces on it: two white rooks, a white king and a black king. "Aha, blacks certainly...
instruction
0
100,692
15
201,384
No
output
1
100,692
15
201,385
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Once Volodya was at the museum and saw a regular chessboard as a museum piece. And there were only four chess pieces on it: two white rooks, a white king and a black king. "Aha, blacks certainly...
instruction
0
100,693
15
201,386
No
output
1
100,693
15
201,387
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Once Volodya was at the museum and saw a regular chessboard as a museum piece. And there were only four chess pieces on it: two white rooks, a white king and a black king. "Aha, blacks certainly...
instruction
0
100,694
15
201,388
No
output
1
100,694
15
201,389
Provide tags and a correct Python 3 solution for this coding contest problem. Alice has got addicted to a game called Sirtet recently. In Sirtet, player is given an n Γ— m grid. Initially a_{i,j} cubes are stacked up in the cell (i,j). Two cells are called adjacent if they share a side. Player can perform the followin...
instruction
0
101,348
15
202,696
Tags: combinatorics, constructive algorithms, math, matrices Correct Solution: ``` from math import ceil,log mod=998244353 n,m,l,r=map(int,input().split()) if (n*m)%2==1: ans=pow(r-l+1,n*m,mod) else: if (r-l+1)%2==0: ans=(pow(r-l+1,n*m,mod)*pow(2,mod-2,mod))%mod else: ans=((pow(r-l+1,n*m,mod...
output
1
101,348
15
202,697
Provide tags and a correct Python 3 solution for this coding contest problem. Alice has got addicted to a game called Sirtet recently. In Sirtet, player is given an n Γ— m grid. Initially a_{i,j} cubes are stacked up in the cell (i,j). Two cells are called adjacent if they share a side. Player can perform the followin...
instruction
0
101,349
15
202,698
Tags: combinatorics, constructive algorithms, math, matrices Correct Solution: ``` import sys readline = sys.stdin.readline def mat_dot(A, B, mod): assert len(A[0]) == len(B), 'invalid_size' L = len(A) M = len(A[0]) N = len(B[0]) res = [[0]*N for _ in range(L)] for i in range(L):...
output
1
101,349
15
202,699
Provide tags and a correct Python 3 solution for this coding contest problem. Alice has got addicted to a game called Sirtet recently. In Sirtet, player is given an n Γ— m grid. Initially a_{i,j} cubes are stacked up in the cell (i,j). Two cells are called adjacent if they share a side. Player can perform the followin...
instruction
0
101,350
15
202,700
Tags: combinatorics, constructive algorithms, math, matrices Correct Solution: ``` mod = 998244353 n,m,l,r = map(int, input().split()) if(n*m % 2 == 1): print(pow(r-l+1,n*m,mod)) elif((r-l+1)%2 == 1): print(((pow(r-l+1,n*m,mod)+1)*(mod+1)//2)%mod) else: print(((pow(r-l+1,n*m,mod))*(mod+1)//2)%mod) ```
output
1
101,350
15
202,701
Provide tags and a correct Python 3 solution for this coding contest problem. Alice has got addicted to a game called Sirtet recently. In Sirtet, player is given an n Γ— m grid. Initially a_{i,j} cubes are stacked up in the cell (i,j). Two cells are called adjacent if they share a side. Player can perform the followin...
instruction
0
101,351
15
202,702
Tags: combinatorics, constructive algorithms, math, matrices Correct Solution: ``` import io import os from collections import Counter, defaultdict, deque DEBUG = False def modInverse(a, p): # Fermat's little theorem, a**(p-1) = 1 mod p return pow(a, p - 2, p) def solve(N, M, L, R): MOD = 998244353 ...
output
1
101,351
15
202,703
Provide tags and a correct Python 3 solution for this coding contest problem. Alice has got addicted to a game called Sirtet recently. In Sirtet, player is given an n Γ— m grid. Initially a_{i,j} cubes are stacked up in the cell (i,j). Two cells are called adjacent if they share a side. Player can perform the followin...
instruction
0
101,352
15
202,704
Tags: combinatorics, constructive algorithms, math, matrices Correct Solution: ``` from sys import stdin input = stdin.readline def main(): mod = 998244353 n,m,l,r = map(int,input().split()) nm = n * m def mult(m1,m2): ans = [0] * 2 ans[0] = (m1[0] * m2[0] + m1[1] * m2...
output
1
101,352
15
202,705
Provide tags and a correct Python 3 solution for this coding contest problem. Alice has got addicted to a game called Sirtet recently. In Sirtet, player is given an n Γ— m grid. Initially a_{i,j} cubes are stacked up in the cell (i,j). Two cells are called adjacent if they share a side. Player can perform the followin...
instruction
0
101,353
15
202,706
Tags: combinatorics, constructive algorithms, math, matrices Correct Solution: ``` def expo(a,n): #print(a) #print(n) if n>0: ha = expo(a,n//2) if n%2==1: return (ha*ha*a)%MOD else: return (ha*ha)%MOD else: return 1 MOD = 998244353 def f(): n,m...
output
1
101,353
15
202,707
Provide tags and a correct Python 3 solution for this coding contest problem. Alice has got addicted to a game called Sirtet recently. In Sirtet, player is given an n Γ— m grid. Initially a_{i,j} cubes are stacked up in the cell (i,j). Two cells are called adjacent if they share a side. Player can perform the followin...
instruction
0
101,354
15
202,708
Tags: combinatorics, constructive algorithms, math, matrices Correct Solution: ``` MOD = 998244353 n,m,l,r = map(int,input().split()) # print(n,m,l,r) if n * m % 2 == 1: print(pow(r - l + 1,n*m,MOD)) else: e = r//2 - (l - 1)//2 o = (r - l + 1) - e # inv_2 = pow(2,MOD-2) print(((pow(e+o,n*m,MOD) + pow(e - o,n*m,MOD...
output
1
101,354
15
202,709
Provide tags and a correct Python 3 solution for this coding contest problem. Alice has got addicted to a game called Sirtet recently. In Sirtet, player is given an n Γ— m grid. Initially a_{i,j} cubes are stacked up in the cell (i,j). Two cells are called adjacent if they share a side. Player can perform the followin...
instruction
0
101,355
15
202,710
Tags: combinatorics, constructive algorithms, math, matrices Correct Solution: ``` n,m,L,R = map(int,input().strip().split()) if(n%2 ==1 and m%2 ==1): print(pow((R-L+1),n*m, 998244353)) else: po = (R-L+1)//2 poo = (R - L + 2) // 2 c = ((pow(po+poo,n*m,998244353) + pow(po-poo,n*m,998244353))*(pow(2,9982443...
output
1
101,355
15
202,711
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Alice has got addicted to a game called Sirtet recently. In Sirtet, player is given an n Γ— m grid. Initially a_{i,j} cubes are stacked up in the cell (i,j). Two cells are called adjacent if the...
instruction
0
101,356
15
202,712
Yes
output
1
101,356
15
202,713
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Alice has got addicted to a game called Sirtet recently. In Sirtet, player is given an n Γ— m grid. Initially a_{i,j} cubes are stacked up in the cell (i,j). Two cells are called adjacent if the...
instruction
0
101,357
15
202,714
Yes
output
1
101,357
15
202,715
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Alice has got addicted to a game called Sirtet recently. In Sirtet, player is given an n Γ— m grid. Initially a_{i,j} cubes are stacked up in the cell (i,j). Two cells are called adjacent if the...
instruction
0
101,358
15
202,716
Yes
output
1
101,358
15
202,717
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Alice has got addicted to a game called Sirtet recently. In Sirtet, player is given an n Γ— m grid. Initially a_{i,j} cubes are stacked up in the cell (i,j). Two cells are called adjacent if the...
instruction
0
101,359
15
202,718
Yes
output
1
101,359
15
202,719
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Alice has got addicted to a game called Sirtet recently. In Sirtet, player is given an n Γ— m grid. Initially a_{i,j} cubes are stacked up in the cell (i,j). Two cells are called adjacent if the...
instruction
0
101,360
15
202,720
No
output
1
101,360
15
202,721
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Alice has got addicted to a game called Sirtet recently. In Sirtet, player is given an n Γ— m grid. Initially a_{i,j} cubes are stacked up in the cell (i,j). Two cells are called adjacent if the...
instruction
0
101,362
15
202,724
No
output
1
101,362
15
202,725
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Alice has got addicted to a game called Sirtet recently. In Sirtet, player is given an n Γ— m grid. Initially a_{i,j} cubes are stacked up in the cell (i,j). Two cells are called adjacent if the...
instruction
0
101,363
15
202,726
No
output
1
101,363
15
202,727
Provide tags and a correct Python 3 solution for this coding contest problem. One tradition of welcoming the New Year is launching fireworks into the sky. Usually a launched firework flies vertically upward for some period of time, then explodes, splitting into several parts flying in different directions. Sometimes t...
instruction
0
101,673
15
203,346
Tags: brute force, data structures, dfs and similar, dp, implementation Correct Solution: ``` import sys plane = set() crackers = {((0, -1), (0, 1))} n = int(input()) a = [int(x) for x in input().split()] crack_dict = { (1, 0): ((1, -1), (1, 1)), (1, 1): ((1, 0), (0, 1)), (0, 1): ((1, 1), (-1, 1)), (...
output
1
101,673
15
203,347
Provide tags and a correct Python 3 solution for this coding contest problem. One tradition of welcoming the New Year is launching fireworks into the sky. Usually a launched firework flies vertically upward for some period of time, then explodes, splitting into several parts flying in different directions. Sometimes t...
instruction
0
101,674
15
203,348
Tags: brute force, data structures, dfs and similar, dp, implementation Correct Solution: ``` k = int(input()) & 1 p = [] s = range(1, 6) for q in map(int, input().split()[::-1]): if k: p += [(x, -y) for x, y in p] p = [(x - q, y) for x, y in p] p += [(-x, 0) for x in s[:q]] else: ...
output
1
101,674
15
203,349
Provide tags and a correct Python 3 solution for this coding contest problem. One tradition of welcoming the New Year is launching fireworks into the sky. Usually a launched firework flies vertically upward for some period of time, then explodes, splitting into several parts flying in different directions. Sometimes t...
instruction
0
101,675
15
203,350
Tags: brute force, data structures, dfs and similar, dp, implementation Correct Solution: ``` from math import sin def mp(): return map(int,input().split()) def lt(): return list(map(int,input().split())) def pt(x): print(x) def ip(): return input() def it(): return int(input()) def sl(x): return [t for t in x] d...
output
1
101,675
15
203,351
Provide tags and a correct Python 3 solution for this coding contest problem. One tradition of welcoming the New Year is launching fireworks into the sky. Usually a launched firework flies vertically upward for some period of time, then explodes, splitting into several parts flying in different directions. Sometimes t...
instruction
0
101,676
15
203,352
Tags: brute force, data structures, dfs and similar, dp, implementation Correct Solution: ``` #!/usr/bin/env python3 from sys import stdin,stdout def ri(): return map(int, input().split()) w = 15 adding = [(0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1), (1, 0), (1, 1)] def fill(x, y,dir,depth): for i i...
output
1
101,676
15
203,353
Provide tags and a correct Python 3 solution for this coding contest problem. One tradition of welcoming the New Year is launching fireworks into the sky. Usually a launched firework flies vertically upward for some period of time, then explodes, splitting into several parts flying in different directions. Sometimes t...
instruction
0
101,677
15
203,354
Tags: brute force, data structures, dfs and similar, dp, implementation Correct Solution: ``` dr = [[0, 1], [1, 1], [1, 0], [1, -1], [0, -1], [-1, -1], [-1, 0], [-1, 1]] n = int(input()) t = [int(i) for i in input().split()] visited = set() N = 150*2 + 10 covers = [[0]*N for i in range(N)] def dfs(d, pos, path): ...
output
1
101,677
15
203,355
Provide tags and a correct Python 3 solution for this coding contest problem. One tradition of welcoming the New Year is launching fireworks into the sky. Usually a launched firework flies vertically upward for some period of time, then explodes, splitting into several parts flying in different directions. Sometimes t...
instruction
0
101,678
15
203,356
Tags: brute force, data structures, dfs and similar, dp, implementation Correct Solution: ``` from collections import defaultdict dx = [0,-1,-1,-1, 0, 1, 1,1] dy = [1, 1, 0,-1,-1,-1, 0,1] #visited =[[[[False for _ in range(32)] for _ in range(8)] for _ in range(320)] for _ in range(320)] visited = defaultdict(lambda ...
output
1
101,678
15
203,357
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One tradition of welcoming the New Year is launching fireworks into the sky. Usually a launched firework flies vertically upward for some period of time, then explodes, splitting into several pa...
instruction
0
101,679
15
203,358
No
output
1
101,679
15
203,359
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One tradition of welcoming the New Year is launching fireworks into the sky. Usually a launched firework flies vertically upward for some period of time, then explodes, splitting into several pa...
instruction
0
101,680
15
203,360
No
output
1
101,680
15
203,361
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One tradition of welcoming the New Year is launching fireworks into the sky. Usually a launched firework flies vertically upward for some period of time, then explodes, splitting into several pa...
instruction
0
101,681
15
203,362
No
output
1
101,681
15
203,363
Provide tags and a correct Python 3 solution for this coding contest problem. Little C loves number Β«3Β» very much. He loves all things about it. Now he is playing a game on a chessboard of size n Γ— m. The cell in the x-th row and in the y-th column is called (x,y). Initially, The chessboard is empty. Each time, he pl...
instruction
0
102,037
15
204,074
Tags: brute force, constructive algorithms, flows, graph matchings Correct Solution: ``` known = [ [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 2, 4], [0, 0, 0, 4, 8, 10], [0, 0, 4, 8, 12, 14], [0, 2, 8, 12, 16, 20], [0, 4, 10, 14, 20, 24] ] n,m = map(int,input().split(" ")) if n>m: n,m = m,n if n<=5 an...
output
1
102,037
15
204,075
Provide tags and a correct Python 3 solution for this coding contest problem. Little C loves number Β«3Β» very much. He loves all things about it. Now he is playing a game on a chessboard of size n Γ— m. The cell in the x-th row and in the y-th column is called (x,y). Initially, The chessboard is empty. Each time, he pl...
instruction
0
102,038
15
204,076
Tags: brute force, constructive algorithms, flows, graph matchings Correct Solution: ``` n,m=map(int,input().split()) if n > m: m,n=n, m if n == 1: if m % 6 == 0: print(m) elif m % 6 <= 3: print(m-(m%6)) else: print(m-(6-m%6)) elif( n == 2 and m == 2 ): print(0) elif( n == 2 and...
output
1
102,038
15
204,077
Provide tags and a correct Python 3 solution for this coding contest problem. Little C loves number Β«3Β» very much. He loves all things about it. Now he is playing a game on a chessboard of size n Γ— m. The cell in the x-th row and in the y-th column is called (x,y). Initially, The chessboard is empty. Each time, he pl...
instruction
0
102,039
15
204,078
Tags: brute force, constructive algorithms, flows, graph matchings Correct Solution: ``` n, m = map(int, input().split()) m,n = max(m,n), min(n,m) a = m * n if m == 7 and n == 2: print(12) exit() if m == 3 and n == 2: print(4) exit() if n == 1: print(a - min(m % 6, 6 - m % 6)) else: if m * n >= ...
output
1
102,039
15
204,079
Provide tags and a correct Python 3 solution for this coding contest problem. Little C loves number Β«3Β» very much. He loves all things about it. Now he is playing a game on a chessboard of size n Γ— m. The cell in the x-th row and in the y-th column is called (x,y). Initially, The chessboard is empty. Each time, he pl...
instruction
0
102,040
15
204,080
Tags: brute force, constructive algorithms, flows, graph matchings Correct Solution: ``` n,m=sorted(map(int,input().split())) print(n*m-{1:min(m%6,6-m%6),2:{2:4,3:2,7:2}.get(m,0)}.get(n,n&1*m&1)) ```
output
1
102,040
15
204,081
Provide tags and a correct Python 3 solution for this coding contest problem. Little C loves number Β«3Β» very much. He loves all things about it. Now he is playing a game on a chessboard of size n Γ— m. The cell in the x-th row and in the y-th column is called (x,y). Initially, The chessboard is empty. Each time, he pl...
instruction
0
102,041
15
204,082
Tags: brute force, constructive algorithms, flows, graph matchings Correct Solution: ``` #yeh dil maange more n,m = map(int,input().split()) if n<m:n,m = m,n ans = 0 d = {0:0,1:1,2:2,3:3,4:2,5:1} if m==1:ans=d[n%6] elif m==2: if n==3:ans=2 elif n==2:ans=4 elif n==7:ans=2 else:ans =(n*m)%2 print(n*m-ans) ```
output
1
102,041
15
204,083
Provide tags and a correct Python 3 solution for this coding contest problem. Little C loves number Β«3Β» very much. He loves all things about it. Now he is playing a game on a chessboard of size n Γ— m. The cell in the x-th row and in the y-th column is called (x,y). Initially, The chessboard is empty. Each time, he pl...
instruction
0
102,042
15
204,084
Tags: brute force, constructive algorithms, flows, graph matchings Correct Solution: ``` import math from decimal import * getcontext().prec = 30 n,m=map(int,input().split()) ans=0 if n<m: n,m=m,n if n<3 and m<3: ans=0 elif m==1: ans+=(n//6)*6 n%=6 if n>3: ans+=(n-3)*2 elif n%4==0 or m%4==0 ...
output
1
102,042
15
204,085
Provide tags and a correct Python 3 solution for this coding contest problem. Little C loves number Β«3Β» very much. He loves all things about it. Now he is playing a game on a chessboard of size n Γ— m. The cell in the x-th row and in the y-th column is called (x,y). Initially, The chessboard is empty. Each time, he pl...
instruction
0
102,043
15
204,086
Tags: brute force, constructive algorithms, flows, graph matchings Correct Solution: ``` from math import * from collections import * import sys sys.setrecursionlimit(10**9) x,y = map(int,input().split()) if(x == 1): s = y%6 if(s == 4): s = 2 if(s == 5): s = 1 print(y-s) exit(0) if(y == 1): s = x%6 if(s == ...
output
1
102,043
15
204,087
Provide tags and a correct Python 3 solution for this coding contest problem. Little C loves number Β«3Β» very much. He loves all things about it. Now he is playing a game on a chessboard of size n Γ— m. The cell in the x-th row and in the y-th column is called (x,y). Initially, The chessboard is empty. Each time, he pl...
instruction
0
102,044
15
204,088
Tags: brute force, constructive algorithms, flows, graph matchings Correct Solution: ``` n,m=map(int,input().split(" ")) if n==1 or m==1: print((((n*m)//6)*6)+((n*m)%6>3)*((((n*m)%6)%3)*2)) elif n*m<6: print(0) elif n*m==6: print(4) elif n*m==14: print(12) # elif (n==2 and m%2==1) or (m==2 and...
output
1
102,044
15
204,089
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little C loves number Β«3Β» very much. He loves all things about it. Now he is playing a game on a chessboard of size n Γ— m. The cell in the x-th row and in the y-th column is called (x,y). Initi...
instruction
0
102,045
15
204,090
Yes
output
1
102,045
15
204,091
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little C loves number Β«3Β» very much. He loves all things about it. Now he is playing a game on a chessboard of size n Γ— m. The cell in the x-th row and in the y-th column is called (x,y). Initi...
instruction
0
102,046
15
204,092
Yes
output
1
102,046
15
204,093
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little C loves number Β«3Β» very much. He loves all things about it. Now he is playing a game on a chessboard of size n Γ— m. The cell in the x-th row and in the y-th column is called (x,y). Initi...
instruction
0
102,047
15
204,094
Yes
output
1
102,047
15
204,095
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little C loves number Β«3Β» very much. He loves all things about it. Now he is playing a game on a chessboard of size n Γ— m. The cell in the x-th row and in the y-th column is called (x,y). Initi...
instruction
0
102,048
15
204,096
Yes
output
1
102,048
15
204,097
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little C loves number Β«3Β» very much. He loves all things about it. Now he is playing a game on a chessboard of size n Γ— m. The cell in the x-th row and in the y-th column is called (x,y). Initi...
instruction
0
102,049
15
204,098
No
output
1
102,049
15
204,099
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little C loves number Β«3Β» very much. He loves all things about it. Now he is playing a game on a chessboard of size n Γ— m. The cell in the x-th row and in the y-th column is called (x,y). Initi...
instruction
0
102,050
15
204,100
No
output
1
102,050
15
204,101
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little C loves number Β«3Β» very much. He loves all things about it. Now he is playing a game on a chessboard of size n Γ— m. The cell in the x-th row and in the y-th column is called (x,y). Initi...
instruction
0
102,051
15
204,102
No
output
1
102,051
15
204,103
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little C loves number Β«3Β» very much. He loves all things about it. Now he is playing a game on a chessboard of size n Γ— m. The cell in the x-th row and in the y-th column is called (x,y). Initi...
instruction
0
102,052
15
204,104
No
output
1
102,052
15
204,105
Provide tags and a correct Python 3 solution for this coding contest problem. In this task Anna and Maria play a game with a very unpleasant rival. Anna and Maria are in the opposite squares of a chessboard (8 Γ— 8): Anna is in the upper right corner, and Maria is in the lower left one. Apart from them, the board has s...
instruction
0
102,140
15
204,280
Tags: dfs and similar Correct Solution: ``` a=list(input() for i in range(8)) ok1=list() ok2=set() ok1.append((7,0)) w=[(1,0),(-1,0),(0,1),(0,-1),(1,-1),(1,1),(-1,-1),(-1,1),(0,0)] for i in range(8) : for pos in ok1 : if pos[0]>=i and a[pos[0]-i][pos[1]] == 'S' : continue for j in w: to=(pos[0]+j[0],pos[1]+...
output
1
102,140
15
204,281
Provide tags and a correct Python 3 solution for this coding contest problem. In this task Anna and Maria play a game with a very unpleasant rival. Anna and Maria are in the opposite squares of a chessboard (8 Γ— 8): Anna is in the upper right corner, and Maria is in the lower left one. Apart from them, the board has s...
instruction
0
102,141
15
204,282
Tags: dfs and similar Correct Solution: ``` f = [] for i in range(8): f.append(input()) d = [[[0 for i in range(8)] for j in range(8)] for k in range(100)] d[0][7][0] = 1 dx = [1, 1, 1, 0, 0, -1, -1, -1, 0] dy = [1, 0, -1, 1, -1, 1, 0, -1, 0] ans = 'LOSE' for i in range(99): for x in range(8): for y ...
output
1
102,141
15
204,283
Provide tags and a correct Python 3 solution for this coding contest problem. In this task Anna and Maria play a game with a very unpleasant rival. Anna and Maria are in the opposite squares of a chessboard (8 Γ— 8): Anna is in the upper right corner, and Maria is in the lower left one. Apart from them, the board has s...
instruction
0
102,142
15
204,284
Tags: dfs and similar Correct Solution: ``` grid=None gridsovertime=None visited=None def readInput(): global grid grid = [] for _ in range(8): grid.append(input()) grid = [[(False if char=='S' else True) for char in row] for row in grid] return grid def getNeighbours(pos): x,y,t = pos newposes = [] for i i...
output
1
102,142
15
204,285
Provide tags and a correct Python 3 solution for this coding contest problem. In this task Anna and Maria play a game with a very unpleasant rival. Anna and Maria are in the opposite squares of a chessboard (8 Γ— 8): Anna is in the upper right corner, and Maria is in the lower left one. Apart from them, the board has s...
instruction
0
102,143
15
204,286
Tags: dfs and similar Correct Solution: ``` start=[] for i in range(8): start.append(input()) a=[start] #start=[".......A","........","........","........","........",".SSSSSSS","S.......","M......."] #a=[start] for i in range(10): tmp=a[-1] tmp=[".......A"]+tmp tmp[1]=tmp[1][:-1]+"." a.append(tmp[:-1...
output
1
102,143
15
204,287
Provide tags and a correct Python 3 solution for this coding contest problem. In this task Anna and Maria play a game with a very unpleasant rival. Anna and Maria are in the opposite squares of a chessboard (8 Γ— 8): Anna is in the upper right corner, and Maria is in the lower left one. Apart from them, the board has s...
instruction
0
102,144
15
204,288
Tags: dfs and similar Correct Solution: ``` from sys import stdin from collections import * from copy import deepcopy def valid(i, j): n, m = [8] * 2 return i > -1 and i < n and j > -1 and j < m def str_inp(n): return list(reversed(list((list(stdin.readline()[:-1]) for x in range(n))))) def check(x, y...
output
1
102,144
15
204,289
Provide tags and a correct Python 3 solution for this coding contest problem. In this task Anna and Maria play a game with a very unpleasant rival. Anna and Maria are in the opposite squares of a chessboard (8 Γ— 8): Anna is in the upper right corner, and Maria is in the lower left one. Apart from them, the board has s...
instruction
0
102,145
15
204,290
Tags: dfs and similar Correct Solution: ``` r, s = [63], ''.join(input() + 'T' for i in range(8)) + 'T' * 9 for i in range(0, 72, 9): t = set() for x in r: for y in (x, x - 1, x + 1, x - 9, x + 9, x - 10, x - 8, x + 10, x + 8): if s[y] == 'T': continue if (y < i or s[y - i] != 'S...
output
1
102,145
15
204,291