結果

問題 No.3093 Please GCD
ユーザー Nzt3Nzt3
提出日時 2022-04-03 19:29:28
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 566 bytes
コンパイル時間 1,645 ms
コンパイル使用メモリ 172,564 KB
実行使用メモリ 197,784 KB
平均クエリ数 505.00
最終ジャッジ日時 2024-05-03 04:29:34
合計ジャッジ時間 16,994 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
24,580 KB
testcase_01 AC 24 ms
24,836 KB
testcase_02 AC 33 ms
24,836 KB
testcase_03 AC 88 ms
24,836 KB
testcase_04 WA -
testcase_05 AC 369 ms
25,460 KB
testcase_06 AC 492 ms
24,940 KB
testcase_07 WA -
testcase_08 AC 339 ms
25,220 KB
testcase_09 AC 112 ms
25,220 KB
testcase_10 AC 23 ms
24,964 KB
testcase_11 AC 41 ms
24,964 KB
testcase_12 WA -
testcase_13 AC 255 ms
25,220 KB
testcase_14 WA -
testcase_15 AC 31 ms
24,964 KB
testcase_16 AC 387 ms
25,220 KB
testcase_17 AC 303 ms
24,964 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 174 ms
24,836 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 663 ms
197,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin>>N;
  vector<int>prime(N+1,1);
  vector<int>ask;
  for(int i=2;i<=N;i++){
    if(prime[i]==0)continue;
    int t=i;
    while(t*i<=N)t*=i;
    ask.push_back(t);
    for(int j=i*i;j<=N;j+=i){
      prime[j]=0;
    }
  }
  random_device sd;
  mt19937 rd(sd());
  shuffle(ask.begin(),ask.end(),rd);
  int ans=1;
  for(int i=0,t;i<min(600,(int)ask.size());i++){
    cout<<"? "<<ask[i]<<endl;
    cin>>t;
    ans*=t;
  }
  cout<<"! "<<ans<<'\n';
}
0