結果
| 問題 |
No.991 N×Mマス計算(構築)
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2025-07-09 06:25:16 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 818 bytes |
| コンパイル時間 | 447 ms |
| コンパイル使用メモリ | 82,468 KB |
| 実行使用メモリ | 81,304 KB |
| 最終ジャッジ日時 | 2025-07-09 06:25:24 |
| 合計ジャッジ時間 | 6,078 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 19 WA * 9 |
ソースコード
import sys
input = sys.stdin.readline
from random import randint
X=int(input())
while True:
N=randint(1,min(X*3+10,10**5))
M=randint(1,min(X*3+10,10**5))
for x in range(N+1):
if x*M>X:
break
rest=X-x*M
if rest==0:
y=0
elif N-x==0:
continue
else:
if rest%(N-x)!=0:
continue
else:
y=rest//(N-x)
#print(N,M,x,y)
mas=(N-x)*(M-y)
#print(mas)
# mas * i == X (mod K)
if mas>X:
K=mas-X
print(N,M,K)
A=[K]*x+[1]*(N-x)
B=[K]*y+[1]*(M-y)
B=["*"]+B
print(*B)
for a in A:
print(a)
exit()
titia