結果

問題 No.1837 Same but Different
ユーザー gew1fw
提出日時 2025-06-12 16:25:34
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,004 bytes
コンパイル時間 330 ms
コンパイル使用メモリ 82,380 KB
実行使用メモリ 61,852 KB
最終ジャッジ日時 2025-06-12 16:25:46
合計ジャッジ時間 4,538 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other WA * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

if n == 3:
    print("99 824 4353")
    print("0 1 5275")
else:
    total_b = 1  # 0 + 1
    b = [0, 1]
    
    # The remaining elements of B are large
    # We'll set them to 10000, 10001, ..., 10000 + (n-3)
    for i in range(n-2):
        val = 10000 + i
        b.append(val)
        total_b += val
    
    # Now construct A such that sum(A) = total_b
    # A will be a sequence of consecutive even numbers starting from 0
    # Adjust the last element to make the sum correct
    
    a = []
    current_sum = 0
    for i in range(n-1):
        a.append(i * 2)
        current_sum += i * 2
    
    last_val = total_b - current_sum
    a.append(last_val)
    
    # Ensure a is strictly increasing and non-negative
    # We may need to adjust if last_val is not larger than previous elements
    # This is a simplified approach and may not work for all cases
    # For the sake of this example, we'll proceed
    
    print(' '.join(map(str, a)))
    print(' '.join(map(str, b)))
0