結果
問題 |
No.1528 Not 1
|
ユーザー |
![]() |
提出日時 | 2021-06-04 22:51:04 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 763 bytes |
コンパイル時間 | 131 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 24,520 KB |
最終ジャッジ日時 | 2024-11-20 05:21:25 |
合計ジャッジ時間 | 39,356 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 5 WA * 2 TLE * 12 |
ソースコード
from math import ceil, gcd import sys n = int(input()) if n == 1 or n == 2: print(-1) sys.exit() l = ceil(n/2) # s_list = list(range(3, n+1, 1)) # print(f'l:{l}') r = [] m = 2 s = 2 r.append(2) while len(r) < l: # s_list.sort() # for i in s_list: for i in range(s, n+1): if len(r) == 0: m += 1 r.append(m) if m > n: print(-1) sys.exit() else: continue if gcd(r[-1], i) != 1 and not i in r: # print(f'push {i}') r.append(i) s = 2 # s_list.remove(i) break elif i == n: s = r.pop() # print(f'pop {s}') if s == n: print(-1) sys.exit() else: s += 1 # s_list.append(s) re = [str(i) for i in r] print(' '.join(re))