結果

問題 No.991 N×Mマス計算(構築)
ユーザー maspy
提出日時 2020-04-23 16:14:15
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 531 ms / 2,000 ms
コード長 505 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 46,420 KB
最終ジャッジ日時 2024-10-13 15:50:54
合計ジャッジ時間 18,534 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np

X = int(read())

N = 10 ** 5
K = 10 ** 9

full = X + (-X) % N
if full == 0:
    full += N
M = full // N

col = np.empty(M, np.int64)
row = np.empty(N, np.int64)
col[0] = 1
col[1:] = K
row[: full - X] = 1
row[full - X:] = K
row[0] = 0
row[0] = (X - row.sum()) % K
if row[0] == 0:
    row[0] = K - 1
    row[1] += 1

print(N, M, K)
print('*', *col)
print(*row, sep='\n')
0