QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#292548#5471. Interactive Number GuessingAlphaMale06WA 1ms3448kbC++141.3kb2023-12-28 08:00:112023-12-28 08:00:12

Judging History

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

  • [2023-12-28 08:00:12]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3448kb
  • [2023-12-28 08:00:11]
  • 提交

answer

#include <bits/stdc++.h>

/*
	Oce nas,
	koji si na nebesima,
	da se sveti ime Tvoje,
	da dodje carstvo Tvoje,
	da bude volja Tvoja,
	i na zemlji, kao i na nebu.
	
	Hleb nas nasusni daj nam danas,
	i oprosti nam dugove nase,
	kao sto i mi oprastamo duznicima svojim,
	i ne uvedi nas u iskusenje,
	no izbavi nas od zloga.
	
	Jer je Tvoje Carstvo,
	i sila, i slava,
	u vekove vekova.
	
	Amin.
*/

using namespace std;
typedef vector<int> vc;
typedef vector<vector<int>> vvc;
using ll = long long;
using ld = long double;
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define F first
#define S second
#define pb push_back
#define pf push_front
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define int long long

int qry(int a){
	cout << "query " << a << endl;
	int x;
	cin >> x;
	return x;
}

void solve(){
	int ds = qry(0);
	int pw=1;
	int nig=0;
	int vals=0;
	for(int i=0; i< 17; i++){
		int l=0; int r=9;
		int ans=10;
		int mn=ds;
		while(l<=r){
			int s=l+r>>1;
			int qryval=qry(s*pw);
			if(qryval>mn){
				l=s+1;
			}
			else{
				mn=qryval;
				r=s-1;
				ans=s;
			}
		}
		nig+=(10-ans)*pw;
		vals+=10-ans;
		pw*=10;
	}
	cout << "answer " << nig << endl;
}

signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	solve();
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3344kb

input:

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

output:

query 0
query 4
query 7
query 5
query 6
query 40
query 70
query 80
query 400
query 700
query 800
query 900
query 4000
query 7000
query 8000
query 9000
query 40000
query 70000
query 80000
query 90000
query 400000
query 700000
query 800000
query 900000
query 4000000
query 7000000
query 8000000
query 9...

result:

ok correct

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3448kb

input:

89
93
87
85
84
90
91
83
93
87
94
95
93
96
97
89
93
87
94
86
93
96
79
84
81
89
93
87
94
86
93
96
97
89
84
90
91
92
93
87
94
86
84
90
91
92
84
90
91
83
84
90
82
93
96
97
89
93
69
94
95
75
72
89

output:

query 0
query 4
query 7
query 5
query 40
query 10
query 20
query 30
query 400
query 700
query 500
query 600
query 4000
query 7000
query 8000
query 9000
query 40000
query 70000
query 50000
query 60000
query 400000
query 700000
query 800000
query 4000000
query 1000000
query 0
query 40000000
query 7000...

result:

wrong answer wrong guess: 93187646149241375  actual: 993187646149241375