結果
問題 | No.2081 Make a Test Case of GCD Subset |
ユーザー | mkawa2 |
提出日時 | 2022-09-25 22:07:12 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,244 bytes |
コンパイル時間 | 304 ms |
コンパイル使用メモリ | 82,184 KB |
実行使用メモリ | 66,636 KB |
最終ジャッジ日時 | 2024-06-01 23:33:05 |
合計ジャッジ時間 | 4,618 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 42 ms
62,944 KB |
testcase_01 | AC | 48 ms
63,436 KB |
testcase_02 | AC | 45 ms
64,400 KB |
testcase_03 | AC | 48 ms
64,072 KB |
testcase_04 | AC | 48 ms
64,200 KB |
testcase_05 | AC | 47 ms
64,688 KB |
testcase_06 | AC | 48 ms
63,372 KB |
testcase_07 | AC | 44 ms
63,708 KB |
testcase_08 | AC | 45 ms
64,272 KB |
testcase_09 | AC | 45 ms
64,620 KB |
testcase_10 | AC | 44 ms
64,436 KB |
testcase_11 | AC | 47 ms
65,376 KB |
testcase_12 | AC | 44 ms
63,376 KB |
testcase_13 | AC | 43 ms
64,416 KB |
testcase_14 | AC | 44 ms
64,204 KB |
testcase_15 | AC | 45 ms
64,048 KB |
testcase_16 | AC | 44 ms
63,592 KB |
testcase_17 | AC | 44 ms
64,232 KB |
testcase_18 | AC | 54 ms
66,636 KB |
testcase_19 | AC | 45 ms
63,632 KB |
testcase_20 | AC | 47 ms
64,680 KB |
testcase_21 | WA | - |
testcase_22 | AC | 46 ms
63,996 KB |
testcase_23 | AC | 43 ms
64,108 KB |
testcase_24 | AC | 41 ms
62,224 KB |
testcase_25 | AC | 43 ms
61,940 KB |
testcase_26 | AC | 41 ms
62,496 KB |
testcase_27 | AC | 43 ms
63,744 KB |
ソースコード
import sys # sys.setrecursionlimit(200005) int1 = lambda x: int(x)-1 pDB = lambda *x: print(*x, end="\n", file=sys.stderr) p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr) def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def LI1(): return list(map(int1, sys.stdin.readline().split())) def LLI1(rows_number): return [LI1() for _ in range(rows_number)] def SI(): return sys.stdin.readline().rstrip() # dij = [(0, 1), (-1, 0), (0, -1), (1, 0)] dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)] inf = (1 << 63)-1 # inf = (1 << 31)-1 # md = 10**9+7 md = 998244353 class Sieve: def __init__(self, n): self.plist = [2] min_prime_factor = [2, 0]*(n//2+1) for x in range(3, n+1, 2): if min_prime_factor[x] == 0: min_prime_factor[x] = x self.plist.append(x) if x**2 > n: continue for y in range(x**2, n+1, 2*x): if min_prime_factor[y] == 0: min_prime_factor[y] = x self.min_prime_factor = min_prime_factor def isprime(self, x): return self.min_prime_factor[x] == x def pf(self, x): pp, ee = [], [] while x > 1: mpf = self.min_prime_factor[x] if pp and mpf == pp[-1]: ee[-1] += 1 else: pp.append(mpf) ee.append(1) x //= mpf return pp, ee # unsorted def factor(self, a): ff = [1] pp, ee = self.pf(a) for p, e in zip(pp, ee): ff, gg = [], ff w = p for _ in range(e): for f in gg: ff.append(f*w) w *= p ff += gg return ff mx = 10**5 sv = Sieve(mx) pp = sv.plist m = II() e = 31 l, r = 0, len(pp)-1 ans = [] while m > r-l+1: while (1 << e) > m+1: e -= 1 while pp[l]*pp[r] > mx: r -= 1 for _ in range(e): ans.append(pp[l]*pp[r]) r -= 1 l += 1 m -= (1 << e)-1 for _ in range(m): ans.append(pp[l]) l += 1 print(len(ans)) print(*ans)