結果

問題 No.1528 Not 1
ユーザー O2MTO2MT
提出日時 2021-06-04 21:48:40
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 779 bytes
コンパイル時間 298 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 86,144 KB
最終ジャッジ日時 2024-04-30 02:24:44
合計ジャッジ時間 3,027 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,224 KB
testcase_01 AC 73 ms
84,864 KB
testcase_02 AC 58 ms
72,448 KB
testcase_03 AC 58 ms
74,624 KB
testcase_04 AC 77 ms
84,352 KB
testcase_05 AC 53 ms
66,688 KB
testcase_06 AC 67 ms
81,152 KB
testcase_07 AC 72 ms
84,960 KB
testcase_08 AC 61 ms
75,648 KB
testcase_09 AC 54 ms
68,352 KB
testcase_10 AC 58 ms
76,416 KB
testcase_11 WA -
testcase_12 AC 38 ms
52,484 KB
testcase_13 AC 38 ms
52,096 KB
testcase_14 AC 37 ms
52,480 KB
testcase_15 WA -
testcase_16 AC 38 ms
52,224 KB
testcase_17 AC 38 ms
52,480 KB
testcase_18 AC 77 ms
86,016 KB
testcase_19 AC 75 ms
86,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from  math import ceil
N = int(input())
if N == 2:
  print(-1)
  exit()
M = ceil(N/2)
evenList = []
num = -1
flg = True
for i in range(2,N+1,2):
  if i%3 == 0:
    if flg:
      num = i
      flg = False
  else:
    evenList.append(i)
ansList = evenList
la = len(ansList)
if num != -1:
  ansList.append(num)
  la += 1
  five = -1
  flg = True
  for i in range(3,N+1,3):
    if la == M:
      break
    if i == num:
      continue
    if i%5 == 0:
      if flg:
        five = i
        flg = False
    else:
      la += 1
      ansList.append(i)
  if five != -1 and la < M:
    ansList.append(num)
    la += 1
    for i in range(5,N+1,5):
      if la == M:
        break
      if i == num:
        continue
      ansList.append(i)

if la == M:
  print(*ansList)
else:
  print(-1)
0