結果
問題 | No.2929 Miracle Branch |
ユーザー | manuo |
提出日時 | 2024-10-12 16:58:13 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,323 bytes |
コンパイル時間 | 432 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 110,080 KB |
最終ジャッジ日時 | 2024-10-12 16:59:04 |
合計ジャッジ時間 | 14,260 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 69 ms
68,608 KB |
testcase_01 | AC | 67 ms
69,120 KB |
testcase_02 | AC | 66 ms
69,120 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 | 98 ms
78,592 KB |
testcase_19 | AC | 113 ms
78,464 KB |
testcase_20 | AC | 108 ms
79,076 KB |
testcase_21 | AC | 113 ms
79,200 KB |
testcase_22 | WA | - |
testcase_23 | AC | 122 ms
79,488 KB |
testcase_24 | AC | 176 ms
86,912 KB |
testcase_25 | WA | - |
testcase_26 | AC | 81 ms
76,256 KB |
testcase_27 | AC | 93 ms
78,592 KB |
testcase_28 | AC | 72 ms
69,376 KB |
testcase_29 | AC | 68 ms
69,504 KB |
testcase_30 | AC | 67 ms
68,992 KB |
testcase_31 | AC | 67 ms
68,864 KB |
testcase_32 | AC | 74 ms
69,504 KB |
testcase_33 | AC | 81 ms
86,528 KB |
testcase_34 | AC | 345 ms
103,296 KB |
testcase_35 | AC | 316 ms
103,232 KB |
testcase_36 | AC | 82 ms
86,912 KB |
testcase_37 | AC | 344 ms
103,168 KB |
testcase_38 | AC | 332 ms
103,424 KB |
testcase_39 | AC | 326 ms
103,168 KB |
testcase_40 | AC | 315 ms
103,040 KB |
testcase_41 | AC | 313 ms
103,296 KB |
testcase_42 | AC | 351 ms
103,040 KB |
testcase_43 | AC | 315 ms
109,952 KB |
testcase_44 | AC | 348 ms
110,080 KB |
testcase_45 | AC | 67 ms
68,992 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) # print(P) 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 > 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)