結果
問題 | No.246 質問と回答 |
ユーザー |
|
提出日時 | 2015-07-17 22:47:32 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 582 bytes |
コンパイル時間 | 468 ms |
コンパイル使用メモリ | 22,656 KB |
実行使用メモリ | 43,044 KB |
最終ジャッジ日時 | 2024-07-16 19:41:46 |
合計ジャッジ時間 | 6,677 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 1 -- * 29 |
コンパイルメッセージ
main.cpp: In lambda function: main.cpp:25:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 25 | scanf("%d",&f); | ~~~~~^~~~~~~~~
ソースコード
#include <cstdio>// cpp_binarysearch (C) @cielavenir under Boost Software License.// type F should be something like std::function<bool(T)>.template<typename T,typename F>T binarysearch(T lo,T hi,T eps,const F &checker){for(;lo+eps<hi;){T mi=(lo+hi)/2;if(checker(mi)){lo=mi;}else{hi=mi;}}return lo;}template<typename T,typename F>T binarysearch(T lo,T hi,const F &checker){return binarysearch(lo,hi,1,checker);}int main(){printf("! %d\n",binarysearch(1,100000000,[&](int t){printf("? %d\n",t);int f;scanf("%d",&f);return f;}));}