結果
| 問題 |
No.2263 Perms
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-04-07 22:37:36 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 691 bytes |
| コンパイル時間 | 157 ms |
| コンパイル使用メモリ | 82,060 KB |
| 実行使用メモリ | 75,504 KB |
| 最終ジャッジ日時 | 2024-10-02 20:02:10 |
| 合計ジャッジ時間 | 7,875 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 8 WA * 31 |
ソースコード
from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline
N,M = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(N)]
if any(sum(a)!=M for a in A):
print(-1)
exit()
if any(sum([A[i][j] for i in range(N)])!=M for j in range(N)):
print(-1)
exit()
ans = []
while max(max(A[i]) for i in range(N)):
tmp = [-1]*N
for i in range(N):
for j in range(N):
if A[j][i]!=0:
if tmp[j]==-1:
tmp[j]=i+1
A[j][i]-=1
break
ans.append(tuple(tmp))
for a in ans:
print(*a)