結果

問題 No.3501 Digit Products 2
コンテスト
ユーザー Bokuneko
提出日時 2026-04-18 00:37:36
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 784 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,448 ms
コンパイル使用メモリ 332,976 KB
実行使用メモリ 30,320 KB
平均クエリ数 10.89
最終ジャッジ日時 2026-04-18 00:38:17
合計ジャッジ時間 11,861 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 51 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  cin >> N;
  vector<int> P(N);
  int k0 = -1;
  int d1 = -1;
  int d2 = -1;
  int k1 = -1;
  int k2 = -1;
  for(int i = 0; i < N-1; i++){
    cout << "? " << i << " " << N-1 << endl;
    cin >> P[i];
    if(P[i] == -1){
      return 0;
    }
    if(d1 == -1 && P[i] != 0){
      d1 = i;
      k1 = P[i];
    }
    else if(d2 == -1 && P[i] != 0){
      d2 = i;
      k2 = P[i];
    }
  }
  if(d1 != -1 && d2 != -1){
    cout << "? " << d1 << " " << d2 << endl;
    cin >> k0;
    double k3;
    k3 = k1 * k2 / k0;
    P[N-1] = sqrt(k3);
    cout << "! " << P[N-1];
    for(int i = 1; i < N; i++){
      cout << P[N-i-1] / P[N-1];
    }
    cout << endl;
  }
  else{
    cout << "! " << -1 << endl;
  }
  return 0;
}
0