結果

問題 No.2357 Guess the Function
ユーザー twooimp
提出日時 2023-06-23 23:01:21
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 616 bytes
コンパイル時間 1,624 ms
コンパイル使用メモリ 174,632 KB
実行使用メモリ 25,604 KB
平均クエリ数 3.00
最終ジャッジ日時 2024-07-01 02:47:25
合計ジャッジ時間 2,828 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 1 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using P=pair<ll,ll>;

int main(){
  ll x1=2,x2=3;
  cout<<'?'<<" "<<x1<<endl;
  ll r1;
  cin>>r1;
  cout<<'?'<<" "<<x2<<endl;
  ll r2;
  cin>>r2;
  set<P> st;
  for(ll b=0;b<=100;b++){
    for(ll a=0;a<b;a++){
      if((x1+a-r1)%b==0&&(x2+a-r2)%b==0){
        if((x1+a-r1)>=0&&(x2+a-r2)>=0){
          st.insert(P(a,b));
        }
      }
    }
  }
  for(auto u:st){
    if(u.second!=1){
      cout<<'!'<<" "<<u.first<<" "<<u.second<<endl;
      exit(0);
    }
  }
  for(auto u:st){
    cout<<'!'<<" "<<u.first<<" "<<u.second<<endl;
    exit(0);
  }
}
0