結果
問題 | No.2929 Miracle Branch |
ユーザー | manuo |
提出日時 | 2024-10-12 16:44:21 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,315 bytes |
コンパイル時間 | 143 ms |
コンパイル使用メモリ | 82,436 KB |
実行使用メモリ | 103,628 KB |
最終ジャッジ日時 | 2024-10-12 16:44:46 |
合計ジャッジ時間 | 10,675 ms |
ジャッジサーバーID (参考情報) |
judge / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 55 ms
69,120 KB |
testcase_01 | AC | 58 ms
71,284 KB |
testcase_02 | AC | 56 ms
71,364 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 83 ms
78,716 KB |
testcase_19 | AC | 84 ms
78,924 KB |
testcase_20 | AC | 88 ms
79,404 KB |
testcase_21 | AC | 93 ms
79,172 KB |
testcase_22 | WA | - |
testcase_23 | AC | 97 ms
79,212 KB |
testcase_24 | AC | 159 ms
87,416 KB |
testcase_25 | WA | - |
testcase_26 | AC | 67 ms
76,348 KB |
testcase_27 | AC | 75 ms
79,144 KB |
testcase_28 | AC | 56 ms
69,844 KB |
testcase_29 | AC | 55 ms
69,708 KB |
testcase_30 | AC | 59 ms
69,656 KB |
testcase_31 | AC | 55 ms
70,044 KB |
testcase_32 | AC | 55 ms
70,292 KB |
testcase_33 | AC | 83 ms
86,992 KB |
testcase_34 | AC | 253 ms
103,628 KB |
testcase_35 | AC | 273 ms
103,072 KB |
testcase_36 | AC | 69 ms
87,768 KB |
testcase_37 | AC | 289 ms
103,308 KB |
testcase_38 | AC | 257 ms
103,500 KB |
testcase_39 | AC | 251 ms
103,512 KB |
testcase_40 | AC | 272 ms
103,432 KB |
testcase_41 | AC | 253 ms
103,168 KB |
testcase_42 | AC | 243 ms
103,168 KB |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | AC | 54 ms
70,456 KB |
ソースコード
from collections import deque, defaultdict, Counter from bisect import bisect_left, bisect_right from itertools import permutations, combinations from functools import cmp_to_key, cache from heapq import heappop, heappush import math, sys import pypyjit pypyjit.set_param('max_unroll_recursion=-1') sys.setrecursionlimit(10**7) _int = lambda x: int(x)-1 MOD = 998244353 INF = 1<<62 Yes, No = "Yes", "No" M = 200000 X = int(input()) def prime(num): num = int(num) p = [] if num < 2: return p p.append(2) memo = [i%2 for i in range(num+1)] for i in range(3, num+1, 2): if memo[i] == 0: continue p.append(i) for j in range(i, num+1, i): memo[j] = 0 return p P = prime(M) if X < 6: print(X+1) for i in range(X): print(1, i+2) C = ["b"]+["g"]*X print(*C) exit() cur = 1 last = -1 UV = [] C = [] for p in P: while X%p == 0: if cur+p+1 > M: print(-1) exit() par = cur if last != -1: UV.append((last, par)) last = par C.append("b") cur += p+1 for i in range(p): UV.append((par, par+i+1)) C.append("g") X //= p if X != 1: print(-1) exit() print(len(C)) for u, v in UV: print(u, v) print(*C)