結果

問題 No.1837 Same but Different
ユーザー 37zigen37zigen
提出日時 2022-02-11 23:11:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 640 bytes
コンパイル時間 840 ms
コンパイル使用メモリ 10,756 KB
実行使用メモリ 8,660 KB
最終ジャッジ日時 2023-09-10 05:58:25
合計ジャッジ時間 4,861 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,764 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 17 ms
7,772 KB
testcase_04 WA -
testcase_05 AC 19 ms
8,592 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 20 ms
8,488 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 20 ms
8,548 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 20 ms
8,604 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 18 ms
8,508 KB
testcase_20 WA -
testcase_21 AC 19 ms
8,492 KB
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(N) :
    a = [3*i if (i < 2 * N // 3) else 3 * (i + 1) for i in range(N)]
    b = [3*i + 1 for i in range(N)] #N個多い
    if sum(a) == sum(b) : # N % 3 == 0
        print(*a)
        print(*b)
        return
    if sum(a[:N-1]) == sum(b[:N-1]):
        a = [3*i if (i <= 2 * N // 3) else 3 * (i + 1) for i in range(N-1)]
        b = [3*i + 1 for i in range(N-1)] #2N個多い
    if sum(a[:N-1]) != sum(b[:N-1]):
        if sum(a[:N-1]) < sum(b[:N-1]) :
            a, b = b, a
        a.pop()
        b.pop()
        a.append(10000-(sum(a)-sum(b)))
        b.append(10000)
        print(*a)
        print(*b)
N=int(input())
f(N)
0