CSES - Aalto Competitive Programming 2024 - wk12 - Wed - Results
Submission details
Task:Even Grid
Sender:esya_rae
Submission time:2024-11-27 16:34:30 +0200
Language:Python3 (PyPy3)
Status:READY
Result:ACCEPTED
Test results
testverdicttime
#1ACCEPTED0.04 sdetails
#2ACCEPTED0.04 sdetails
#3ACCEPTED0.04 sdetails
#4ACCEPTED0.04 sdetails
#5ACCEPTED0.04 sdetails
#6ACCEPTED0.04 sdetails
#7ACCEPTED0.04 sdetails
#8ACCEPTED0.04 sdetails
#9ACCEPTED0.04 sdetails
#10ACCEPTED0.06 sdetails
#11ACCEPTED0.06 sdetails

Code

import sys
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
mod = (10 ** 9) + 7

n = int(input())
d = [[0] * n for _ in range(n)]
s = input().strip()
for i in range(n):
    d[0][i] = int(s[i])
for i in range(1, n):
    s = input().strip()
    d[i][0] = int(s[0])

for i in range(1, n):
    for j in range(1, n):
        if d[i][0] == d[0][j] == 1:
            d[i][j] = 1
for i in range(n):
    print(*d[i], sep='')

Test details

Test 1

Verdict: ACCEPTED

input
2
11
1?

correct output
11
11

user output
11
11

Test 2

Verdict: ACCEPTED

input
3
101
1??
0??

correct output
101
101
000

user output
101
101
000

Test 3

Verdict: ACCEPTED

input
4
1010
0???
1???
0???

correct output
1010
0000
1010
0000

user output
1010
0000
1010
0000

Test 4

Verdict: ACCEPTED

input
5
11101
1????
1????
1????
...

correct output
11101
11101
11101
11101
00000

user output
11101
11101
11101
11101
00000

Test 5

Verdict: ACCEPTED

input
5
10111
1????
1????
0????
...

correct output
10111
10111
10111
00000
10111

user output
10111
10111
10111
00000
10111

Test 6

Verdict: ACCEPTED

input
5
11000
0????
0????
0????
...

correct output
11000
00000
00000
00000
11000

user output
11000
00000
00000
00000
11000

Test 7

Verdict: ACCEPTED

input
5
10100
1????
0????
1????
...

correct output
10100
10100
00000
10100
10100

user output
10100
10100
00000
10100
10100

Test 8

Verdict: ACCEPTED

input
5
10100
1????
1????
0????
...

correct output
10100
10100
10100
00000
10100

user output
10100
10100
10100
00000
10100

Test 9

Verdict: ACCEPTED

input
10
1010000000
1?????????
0?????????
0?????????
...

correct output
1010000000
1010000000
0000000000
0000000000
0000000000
...

user output
1010000000
1010000000
0000000000
0000000000
0000000000
...

Test 10

Verdict: ACCEPTED

input
100
100010110100011000001111001110...

correct output
100010110100011000001111001110...

user output
100010110100011000001111001110...

Test 11

Verdict: ACCEPTED

input
100
100100110000010110111101111101...

correct output
100100110000010110111101111101...

user output
100100110000010110111101111101...