結果
| 問題 | 
                            No.1384 Bishop and Rook
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-01-08 12:29:10 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 684 bytes | 
| コンパイル時間 | 174 ms | 
| コンパイル使用メモリ | 82,560 KB | 
| 実行使用メモリ | 65,408 KB | 
| 最終ジャッジ日時 | 2024-07-03 23:19:46 | 
| 合計ジャッジ時間 | 13,427 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | RE * 1 | 
| other | RE * 55 | 
ソースコード
n, m = map(int, input().split())
if n % 2 == 1 or m % 2 == 1:
    print(-1)
    exit()
print(n*m - 1)
for i in range(0, n, 2):
    t = range(0, m, 2)
    for j in (t if i%4 == 0 else reversed(t)):
        if i % 4 == 0:
            if j == 0:
                print(i+1, j+2)
                print(i+2, j+1)
            else:
                print(i+2, j+1)
                print(i+1, j+2)
            print(i+1, j+1)
            print(i+2, j+2)
        else:
            print(i+1, j+2)
            print(i+2, j+1)
            if j == 0:
                print(i+1, j+1)
                print(i+2, j+2)
            else:
                print(i+2, j+2)
                print(i+1, j+1)