QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#223959#5471. Interactive Number GuessinguroskWA 0ms3416kbC++141.3kb2023-10-22 22:34:162023-10-22 22:34:16

Judging History

你现在查看的是最新测评结果

  • [2023-10-22 22:34:16]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3416kb
  • [2023-10-22 22:34:16]
  • 提交

answer

#define here cerr<<"===========================================\n"
#define dbg(x) cerr<<#x<<": "<<x<<endl;
#include <bits/stdc++.h>
#define ld double
#define ll long long
#define ull unsigned long long
#define llinf 100000000000000000LL // 10^17
#define iinf 2000000000 // 2*10^9
#define pb push_back
#define eb emplace_back
#define popb pop_back
#define fi first
#define sc second
#define endl '\n'
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pld pair<ld,ld>
#define all(a) a.begin(),a.end()
#define ceri(a,l,r) {cerr<<#a<<": ";for(ll i_ = l;i_<=r;i_++) cerr<<a[i_]<< " ";cerr<<endl;}
#define cer(a) {cerr<<#a<<": ";for(ll x_ : a) cerr<<x_<< " ";cerr<<endl;}
#define si(a) (ll)(a.size())
using namespace std;

ll ask(ll x){
    cout<<"query "<<x<<endl;
    ll ans; cin >> ans;
    return ans;
}
void tc(){
    ll c = 1;
    ll poc = ask(0);
    ll ans = 0;
    for(ll d = 1;d<=18;d++){
        ll l = 1,r = 10,mid,rez;
        while(l<=r){
            mid = (l+r)/2;
            if(ask(mid*c)<poc){
                rez = mid;
                r = mid-1;
            }else l = mid+1;
        }
        ans+=(10-rez)*c;
        c*=10;
        dbg(ans);
    }
    cout<<"answer "<<ans<<endl;
}

int main(){
	int t; t = 1;
	while(t--){
		tc();
	}
	return (0-0);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3416kb

input:

6
11
5
12
4
11
5
12
13
11
14
6
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15

output:

query 0
query 5
query 8
query 6
query 7
query 50
query 80
query 60
query 70
query 500
query 800
query 900
query 1000
query 5000
query 8000
query 9000
query 10000
query 50000
query 80000
query 90000
query 100000
query 500000
query 800000
query 900000
query 1000000
query 5000000
query 8000000
query 90...

result:

wrong answer invalid range in query_count=72: 1000000000000000000