結果

問題 No.1837 Same but Different
ユーザー lam6er
提出日時 2025-03-31 18:00:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 660 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 82,748 KB
実行使用メモリ 62,844 KB
最終ジャッジ日時 2025-03-31 18:01:46
合計ジャッジ時間 4,068 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other WA * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

# Construct B
if n == 3:
    B = [0, 1, 5275]
    sum_s = 5276
else:
    sum_s = 10000 * n
    B = [0, 1]
    remain = sum_s - 0 - 1
    next_val = 2
    while len(B) < n - 1:
        B.append(next_val)
        remain -= next_val
        next_val += 1
    B.append(remain)

sum_s = sum(B)

# Construct A
A = [99, 824]
current_sum = sum(A)
remaining = sum_s - current_sum
step = 500

for _ in range(n - 2):
    next_val = A[-1] + step
    A.append(next_val)
    current_sum += next_val

# Adjust the last element to make sum correct
current_sum = sum(A)
A[-1] += (sum_s - current_sum)

print(' '.join(map(str, A)))
print(' '.join(map(str, B)))
0