結果

問題 No.1837 Same but Different
ユーザー 37zigen37zigen
提出日時 2022-02-11 23:52:33
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 19 ms / 2,000 ms
コード長 552 bytes
コンパイル時間 219 ms
コンパイル使用メモリ 10,952 KB
実行使用メモリ 8,704 KB
最終ジャッジ日時 2023-09-10 06:58:04
合計ジャッジ時間 2,439 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,948 KB
testcase_01 AC 16 ms
7,836 KB
testcase_02 AC 16 ms
7,840 KB
testcase_03 AC 16 ms
7,900 KB
testcase_04 AC 19 ms
8,684 KB
testcase_05 AC 19 ms
8,556 KB
testcase_06 AC 19 ms
8,704 KB
testcase_07 AC 19 ms
8,692 KB
testcase_08 AC 19 ms
8,528 KB
testcase_09 AC 19 ms
8,528 KB
testcase_10 AC 19 ms
8,660 KB
testcase_11 AC 19 ms
8,672 KB
testcase_12 AC 19 ms
8,700 KB
testcase_13 AC 19 ms
8,688 KB
testcase_14 AC 19 ms
8,608 KB
testcase_15 AC 18 ms
8,412 KB
testcase_16 AC 17 ms
8,384 KB
testcase_17 AC 17 ms
8,444 KB
testcase_18 AC 17 ms
8,656 KB
testcase_19 AC 17 ms
8,576 KB
testcase_20 AC 17 ms
8,396 KB
testcase_21 AC 17 ms
8,452 KB
testcase_22 AC 16 ms
8,244 KB
testcase_23 AC 16 ms
8,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(N) :
    a = [3*i if (i < 2 * N // 3 + 300) else 3 * (i + 1) for i in range(N)]
    b = [3*i + 1 for i in range(N)] #3*300個多い
    if (N < 10) : 
        for i in range(N):
            b[i] += 300
    if (sum(b)-sum(a)) % 3 != 2: 
        a[-1] += sum(b)-sum(a)
    else : 
        d = sum(b) - sum(a)
        if d % 6 == 2 : 
            a[-2] += d // 6 * 3 + 1
            a[-1] += d // 6 * 3 + 1
        else : 
            a[-2] += d // 6 * 3 + 1
            a[-1] += d // 6 * 3 + 4

    print(*a)
    print(*b)
    
N=int(input())
f(N)
0