結果
問題 | No.3093 Please GCD |
ユーザー | nasubi24 |
提出日時 | 2022-04-01 22:41:49 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 785 bytes |
コンパイル時間 | 436 ms |
コンパイル使用メモリ | 82,552 KB |
実行使用メモリ | 94,560 KB |
平均クエリ数 | 922.30 |
最終ジャッジ日時 | 2024-04-30 15:00:58 |
合計ジャッジ時間 | 11,472 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | AC | 97 ms
81,860 KB |
testcase_02 | AC | 104 ms
83,316 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 202 ms
85,392 KB |
testcase_07 | AC | 202 ms
85,548 KB |
testcase_08 | WA | - |
testcase_09 | AC | 203 ms
83,728 KB |
testcase_10 | RE | - |
testcase_11 | AC | 115 ms
85,532 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | AC | 205 ms
86,748 KB |
testcase_15 | AC | 103 ms
82,968 KB |
testcase_16 | AC | 206 ms
84,220 KB |
testcase_17 | WA | - |
testcase_18 | AC | 205 ms
87,036 KB |
testcase_19 | WA | - |
testcase_20 | AC | 210 ms
84,656 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 206 ms
86,292 KB |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | AC | 392 ms
94,560 KB |
testcase_27 | WA | - |
testcase_28 | AC | 210 ms
86,152 KB |
testcase_29 | AC | 368 ms
93,888 KB |
ソースコード
import math import random n=int(input()) p=[] for i in range(2,n+1): for j in range(2,i): if i%j==0: break else: p.append(i) now=0 num=1 num2=1 cnt=0 while now!=len(p) and cnt<=20: tem=1 while now!=len(p): if tem*p[now]>n: break tem*=p[now] now+=1 cnt+=1 print("?",tem,flush=True) k=int(input()) num*=k num2*=tem//k while cnt<=420: while True: num3=random.randint(20,n) if math.gcd(num3,num)==1: break cnt+=1 print("?",num3,flush=True) k=int(input()) num*=k num2*=tem//k ans=num for i in range(2,(n//num)+1): if math.gcd(num2,i)==1: print("?",num*i,flush=True) ans=max(ans,int(input())) print("!",ans,flush=True)