結果

問題 No.2719 Equal Inner Products in Permutation
ユーザー ecottea
提出日時 2024-02-03 19:24:21
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 563 bytes
コンパイル時間 437 ms
コンパイル使用メモリ 82,460 KB
実行使用メモリ 814,548 KB
最終ジャッジ日時 2024-09-28 12:46:41
合計ジャッジ時間 4,460 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 3 RE * 1 MLE * 1 -- * 25
権限があれば一括ダウンロードができます

ソースコード

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
    b = b2
    c = c2
elif n % 3 == 0:
    a = a3
    b = b3
    c = c3
else:
    a = a4
    b = b4
    c = c4

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)
    len += 3

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