結果

問題 No.2719 Equal Inner Products in Permutation
ユーザー ecotteaecottea
提出日時 2024-02-03 19:27:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 173 ms / 2,000 ms
コード長 624 bytes
コンパイル時間 173 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 140,100 KB
最終ジャッジ日時 2024-02-08 17:19:25
合計ジャッジ時間 7,475 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
55,596 KB
testcase_01 AC 40 ms
55,596 KB
testcase_02 AC 40 ms
55,596 KB
testcase_03 AC 39 ms
55,596 KB
testcase_04 AC 43 ms
55,596 KB
testcase_05 AC 40 ms
55,596 KB
testcase_06 AC 41 ms
55,596 KB
testcase_07 AC 41 ms
55,596 KB
testcase_08 AC 40 ms
55,596 KB
testcase_09 AC 40 ms
55,596 KB
testcase_10 AC 55 ms
66,512 KB
testcase_11 AC 54 ms
68,604 KB
testcase_12 AC 53 ms
66,512 KB
testcase_13 AC 55 ms
66,520 KB
testcase_14 AC 55 ms
68,604 KB
testcase_15 AC 152 ms
130,376 KB
testcase_16 AC 169 ms
136,628 KB
testcase_17 AC 132 ms
119,032 KB
testcase_18 AC 165 ms
136,868 KB
testcase_19 AC 157 ms
126,408 KB
testcase_20 AC 123 ms
115,644 KB
testcase_21 AC 162 ms
137,928 KB
testcase_22 AC 136 ms
118,608 KB
testcase_23 AC 134 ms
122,428 KB
testcase_24 AC 118 ms
113,492 KB
testcase_25 AC 164 ms
138,540 KB
testcase_26 AC 164 ms
137,504 KB
testcase_27 AC 172 ms
140,100 KB
testcase_28 AC 166 ms
138,540 KB
testcase_29 AC 173 ms
137,504 KB
testcase_30 AC 173 ms
140,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

n = int(input())

if n == 1:
    print(-1)
    exit(0)

a2 = [1, 4]
b2 = [3, 6]
c2 = [5, 2]
a3 = [1, 2, 9]
b3 = [6, 8, 7]
c3 = [3, 4, 5]
a4 = [1, 2, 4, 11]
b4 = [7, 9, 10, 12]
c4 = [8, 5, 6, 3]

if n % 3 == 2:
    a = a2.copy()
    b = b2.copy()
    c = c2.copy()
elif n % 3 == 0:
    a = a3.copy()
    b = b3.copy()
    c = c3.copy()
else:
    a = a4.copy()
    b = b4.copy()
    c = c4.copy()

l = len(a)
while l < n:
    for x in a3:
        a.append(x + 3 * l)
    for x in b3:
        b.append(x + 3 * l)
    for x in c3:
        c.append(x + 3 * l)
    l += 3

print(*(a + b + c))
0