Submission #4060155


Source Code Expand

H,W = map(int,input().split())

A=[]
for i in range(H):
    A.append(list(map(int,input().split())))

num=0
ans=''

for i in range(H):
    for j in range(W):
        if i%2==0:
            n=j
        else:
            n=W-1-j
        if A[i][n]%2==1:
            A[i][n]-=1
            if i!=H-1 and (i%2==0 and n==W-1) or (i%2==1 and n==0):
                num+=1
                A[i+1][n]+=1
                ans+='{} {} {} {}\n'.format(i+1,n+1,i+2,n+1)
            if (i%2==0 and n!=W-1) or (i%2==1 and n!=0):
                num+=1
                A[i][n+(-1)**(i%2)]+=1
                ans+='{} {} {} {}\n'.format(i+1,n+1,i+1,n+1+(-1)**(i%2))
print(num)
print(ans[:-1])

Submission Info

Submission Time
Task D - Make Them Even
User nuko274
Language PyPy3 (2.4.0)
Score 0
Code Size 704 Byte
Status RE
Exec Time 2112 ms
Memory 139404 KB

Judge Result

Set Name All Sample
Score / Max Score 0 / 400 0 / 0
Status
AC × 9
TLE × 19
RE × 1
AC × 3
Set Name Test Cases
All hand_1, hand_2, hand_3, hand_4, hand_5, hand_6, max_1, max_10, max_2, max_3, max_4, max_5, max_6, max_7, max_8, max_9, random_1, random_10, random_2, random_3, random_4, random_5, random_6, random_7, random_8, random_9, sample_01, sample_02, sample_03
Sample sample_01, sample_02, sample_03
Case Name Status Exec Time Memory
hand_1 AC 184 ms 38256 KB
hand_2 AC 174 ms 38256 KB
hand_3 AC 174 ms 38256 KB
hand_4 AC 192 ms 38512 KB
hand_5 TLE 2112 ms 137364 KB
hand_6 AC 256 ms 43228 KB
max_1 TLE 2112 ms 136968 KB
max_10 TLE 2112 ms 137224 KB
max_2 TLE 2112 ms 137448 KB
max_3 TLE 2111 ms 137708 KB
max_4 TLE 2112 ms 137864 KB
max_5 TLE 2112 ms 137224 KB
max_6 TLE 2112 ms 138504 KB
max_7 TLE 2112 ms 138632 KB
max_8 TLE 2112 ms 139404 KB
max_9 TLE 2112 ms 137608 KB
random_1 RE 191 ms 39536 KB
random_10 TLE 2014 ms 136972 KB
random_2 TLE 2112 ms 137096 KB
random_3 TLE 2111 ms 138044 KB
random_4 AC 1269 ms 136440 KB
random_5 TLE 2111 ms 138804 KB
random_6 TLE 2112 ms 137036 KB
random_7 TLE 2112 ms 136952 KB
random_8 TLE 2112 ms 136880 KB
random_9 TLE 2112 ms 137236 KB
sample_01 AC 172 ms 38256 KB
sample_02 AC 174 ms 38256 KB
sample_03 AC 181 ms 38256 KB