結果
問題 | No.513 宝探し2 |
ユーザー | algon_320 |
提出日時 | 2017-05-05 23:06:47 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,653 bytes |
コンパイル時間 | 1,443 ms |
コンパイル使用メモリ | 168,912 KB |
実行使用メモリ | 25,604 KB |
平均クエリ数 | 105.83 |
最終ジャッジ日時 | 2024-07-16 13:07:55 |
合計ジャッジ時間 | 3,776 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | AC | 23 ms
25,208 KB |
testcase_03 | AC | 24 ms
25,220 KB |
testcase_04 | AC | 28 ms
24,964 KB |
testcase_05 | AC | 22 ms
24,580 KB |
testcase_06 | WA | - |
testcase_07 | AC | 23 ms
25,520 KB |
testcase_08 | AC | 22 ms
24,964 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/istream:39, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/sstream:38, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/complex:45, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ccomplex:39, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/x86_64-pc-linux-gnu/bits/stdc++.h:54, from main.cpp:1: In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]', inlined from 'int main()' at main.cpp:71:15: /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ostream:202:25: warning: 'X' may be used uninitialized [-Wmaybe-uninitialized] 202 | { return _M_insert(__n); } | ~~~~~~~~~^~~~~ main.cpp: In function 'int main()': main.cpp:48:9: note: 'X' was declared here 48 | int X,Y=0; | ^
ソースコード
#include <bits/stdc++.h> using namespace std; #define int long long using ll=long long; using vi=vector<int>; using vl=vector<long long>; using pii=pair<int,int>; using pll=pair<long long,long long>; #define ITR(i,c) for(auto i=begin(c);i!=end(c);++i) #define FORE(x,c) for(auto &x:c) #define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i) #define REP(i,n) REPF(i,0,n) #define REPR(i,n) for(int i=(int)(n);i>=0;--i) #define REPW(i,n) for(i=0;i<(int)(n);++i) #define ALL(c) begin(c),end(c) #define RALL(c) rbegin(c),rend(c) // c++14 #define SZ(c) ((int)c.size()) #define EXIST(c,x) (c.find(x)!=end(c)) #define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w) #define dump(...) const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0}; #define INF (1001001001) #define INFLL (1001001001001001001ll) template<class T> ostream& operator << (ostream &os,const vector<T> &v) { ITR(i,v) os << *i << (i==end(v)-1 ? "" : " "); return os; } template<class T> istream& operator >> (istream &is,vector<T> &v) { ITR(i,v) is >> * i; return is; } template<class T> istream& operator >> (istream &is, pair<T,T> &p) { is >> p.first >> p.second; return is; } template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;} template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;} //------------------------------------------------------------------------------ struct before_main_function { before_main_function() { #ifdef int #undef INF #define INF INFLL #define stoi stoll #endif cin.tie(0);ios::sync_with_stdio(false); cout<<setprecision(15)<<fixed; } } before_main_function; //------------------------------------------------------------------------------ signed main() { int l=-1,r=100001; int X,Y=0; while(l<=r) { int m1=l+(r-l)/3, m2=l+(r-l)*2/3; cout<<m1<<" "<<0<<endl; int t1,t2; cin>>t1; cout<<m2<<" "<<0<<endl; cin>>t2; if(m2-m1<=1) { if(t1<t2) X=m1; else X=m2; break; } if(t1<t2) { r=m2; } else { l=m1; } } l=0,r=100001; while(l<=r) { int m1=l+(r-l)/3, m2=l+(r-l)*2/3; cout<<X<<" "<<m1<<endl; int t1,t2; cin>>t1; cout<<X<<" "<<m2<<endl; cin>>t2; if(m2-m1<=1) { if(t1<t2) Y=m1; else Y=m2; break; } if(t1<t2) { r=m2; } else { l=m1; } } cout<<X<<" "<<Y<<endl; return 0; }