結果
問題 |
No.513 宝探し2
|
ユーザー |
![]() |
提出日時 | 2017-05-18 01:03:25 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 848 bytes |
コンパイル時間 | 978 ms |
コンパイル使用メモリ | 91,524 KB |
最終ジャッジ日時 | 2025-01-05 00:20:32 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 12 |
ソースコード
#include <cstdio> #include <random> #include <vector> #include <algorithm> #include <array> using namespace std; const bool TEST=false; int manhattan(int x1,int y1,int x2,int y2){ return abs(x1-x2)+abs(y1-y2); } int getcount=0; int get(int x,int y){ getcount++; if(TEST){ return manhattan(x,y,810,1919); } printf("%d %d\n",x,y); int mh; int _=scanf("%d",&mh); return mh; } int main(){ random_device rd; mt19937 mt(rd()); array<int,3> a; a[0]=a[1]=100000/2; a[2]=get(a[0],a[1]); while(a[2]){ array<int,3> b; uniform_int_distribution<> xdist(a[0]-a[2],a[0]+a[2]); uniform_int_distribution<> ydist(a[1]-a[2],a[1]+a[2]); b[0]=xdist(mt); b[1]=ydist(mt); b[2]=get(b[0],b[1]); if(TEST){ printf("%d,%d,%d\n",b[0],b[1],b[2]); } if(a[2]>b[2]) a=b; } if(TEST){ printf("getcount=%d\n",getcount); } return 0; }