結果

問題 No.2719 Equal Inner Products in Permutation
ユーザー PNJPNJ
提出日時 2024-04-05 22:25:20
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,068 bytes
コンパイル時間 148 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 154,456 KB
最終ジャッジ日時 2024-04-05 22:25:36
合計ジャッジ時間 7,689 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 WA -
testcase_02 AC 37 ms
53,460 KB
testcase_03 AC 37 ms
53,460 KB
testcase_04 AC 36 ms
53,460 KB
testcase_05 AC 36 ms
53,460 KB
testcase_06 AC 39 ms
53,460 KB
testcase_07 AC 39 ms
53,460 KB
testcase_08 AC 37 ms
53,460 KB
testcase_09 AC 37 ms
53,460 KB
testcase_10 AC 51 ms
64,420 KB
testcase_11 AC 55 ms
66,512 KB
testcase_12 AC 50 ms
64,420 KB
testcase_13 AC 50 ms
64,428 KB
testcase_14 AC 52 ms
66,512 KB
testcase_15 AC 167 ms
141,316 KB
testcase_16 AC 174 ms
147,368 KB
testcase_17 AC 128 ms
118,624 KB
testcase_18 AC 169 ms
151,056 KB
testcase_19 AC 150 ms
136,220 KB
testcase_20 AC 122 ms
114,400 KB
testcase_21 AC 174 ms
151,124 KB
testcase_22 AC 140 ms
128,392 KB
testcase_23 AC 134 ms
122,512 KB
testcase_24 AC 121 ms
113,096 KB
testcase_25 AC 169 ms
151,780 KB
testcase_26 AC 172 ms
154,456 KB
testcase_27 AC 172 ms
152,728 KB
testcase_28 AC 178 ms
152,388 KB
testcase_29 AC 173 ms
151,780 KB
testcase_30 AC 169 ms
154,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
if N == 1:
  print(-1)

if N % 4 == 0:
  P = []
  Q = []
  R = []
  for i in range(N):
    if i % 4 == 0 or i % 4 == 3:
      P.append(3*i + 1)
      R.append(3*i + 2)
    else:
      P.append(3*i + 2)
      R.append(3*i + 1)
    Q.append(3*i + 3)

elif N % 4 == 1:
  P = [1,4,7,8,14]
  Q = [3,6,12,13,15]
  R = [5,2,10,11,9]
  for i in range(5,N):
    j = i - 5
    if j % 4 == 0 or j % 4 == 3:
      P.append(3*i + 1)
      R.append(3*i + 2)
    else:
      P.append(3*i + 2)
      R.append(3*i + 1)
    Q.append(3*i + 3)

elif N % 4 == 2:
  P = [1,4]
  Q = [3,6]
  R = [5,2]
  for i in range(2,N):
    j = i - 2
    if j % 4 == 0 or j % 4 == 3:
      P.append(3*i + 1)
      R.append(3*i + 2)
    else:
      P.append(3*i + 2)
      R.append(3*i + 1)
    Q.append(3*i + 3)

else:
  P = [1,2,8]
  Q = [3,6,9]
  R = [7,5,4]
  for i in range(3,N):
    j = i - 3
    if j % 4 == 0 or j % 4 == 3:
      P.append(3*i + 1)
      R.append(3*i + 2)
    else:
      P.append(3*i + 2)
      R.append(3*i + 1)
    Q.append(3*i + 3)

ans = P + Q + R
print(*ans)
0