結果

問題 No.991 N×Mマス計算(構築)
ユーザー maspymaspy
提出日時 2020-04-23 16:14:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 564 ms / 2,000 ms
コード長 505 bytes
コンパイル時間 300 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 46,416 KB
最終ジャッジ日時 2024-04-21 16:52:45
合計ジャッジ時間 20,020 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 517 ms
45,896 KB
testcase_01 AC 526 ms
46,296 KB
testcase_02 AC 517 ms
46,160 KB
testcase_03 AC 509 ms
46,168 KB
testcase_04 AC 515 ms
46,156 KB
testcase_05 AC 534 ms
45,908 KB
testcase_06 AC 530 ms
46,156 KB
testcase_07 AC 513 ms
46,024 KB
testcase_08 AC 563 ms
46,032 KB
testcase_09 AC 564 ms
46,156 KB
testcase_10 AC 555 ms
45,776 KB
testcase_11 AC 552 ms
46,412 KB
testcase_12 AC 541 ms
46,156 KB
testcase_13 AC 527 ms
45,900 KB
testcase_14 AC 508 ms
45,652 KB
testcase_15 AC 515 ms
45,876 KB
testcase_16 AC 530 ms
46,152 KB
testcase_17 AC 542 ms
46,032 KB
testcase_18 AC 533 ms
46,416 KB
testcase_19 AC 524 ms
46,364 KB
testcase_20 AC 525 ms
45,644 KB
testcase_21 AC 533 ms
46,168 KB
testcase_22 AC 536 ms
45,900 KB
testcase_23 AC 543 ms
45,652 KB
testcase_24 AC 528 ms
45,896 KB
testcase_25 AC 534 ms
46,280 KB
testcase_26 AC 525 ms
45,516 KB
testcase_27 AC 528 ms
46,160 KB
testcase_28 AC 532 ms
46,156 KB
testcase_29 AC 532 ms
45,788 KB
権限があれば一括ダウンロードができます

ソースコード

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