QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#607035#5556. Diabolic Doofenshmirtzwhale_island#WA 1ms3688kbC++202.3kb2024-10-03 13:43:022024-10-03 13:43:03

Judging History

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

  • [2024-10-03 13:43:03]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3688kb
  • [2024-10-03 13:43:02]
  • 提交

answer

//   __________________
//  | ________________ |
//  ||          ____  ||
//  ||   /\    |      ||
//  ||  /__\   |      ||
//  || /    \  |____  ||
//  ||________________||
//  |__________________|
//  \###################\
//   \###################\
//    \        ____       \
//     \_______\___\_______\
// An AC a day keeps the doctor away.
//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
#define hutao_my_wife ios_base::sync_with_stdio(0);
#define forcalors_so_cute cin.tie(0);
/*

struct A {
	public: [[nodiscard]] virtual const unsigned long long reference operator bitor (const unsigned long long reference a) const noexcept;

};

struct B: public A{

	public: [[nodiscard]] virtual const unsigned long long reference operator bitor (const unsigned long long reference a) const noexcept override final {

	
	}

};

inline char readchar() noexcept {
    static char buffer[BUFSIZ], * now = buffer + BUFSIZ, * end = buffer + BUFSIZ;
    if (now == end)
    {
        if (end < buffer + BUFSIZ)
            return EOF;
        end = (buffer + fread(buffer, 1, BUFSIZ, stdin));
        now = buffer;
    }
    return *now++;
}
inline int nextint() noexcept {
    int x = 0, c = readchar(), neg = 0;
    while(('0' > c || c > '9') && c!='-' && c!=EOF) c = readchar();
    if(c == '-') neg = true, c = readchar();
    while('0' <= c && c <= '9') x = (x<<3) + (x<<1) + (c^'0'), c = readchar();
    if(neg) x = -x;
    return x; // returns 0 if EOF
}

//fast io cin>>a 改成 a = nextint();
*/
#define ll long long
//#define int long long
#define pii pair<int,int>
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define ALL(v) v.begin(), v.end()
#define bug(A) cout<<A<<" hi\n";
using namespace std;

const ll M = 200005;

void solve(){
    ll l = 0, r = 1e12,base = 0, mid;
    while(r - l > 1){
        mid = (r + l)/2;
        
        cout<<"? "<<mid + base<<endl;
        ll ret;
        cin>>ret;
        base = mid+base-ret;
        if(ret < mid){
            r = mid;
        }else{
            l = mid;
        }
    }
    cout<<"! "<<r<<endl;
}

signed main(){
//    hutao_my_wife    forcalors_so_cute

    int t = 1;
    //cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3688kb

input:

32
16
8
4
2
22
32
16
8
4
2
1
0
0
0
21
10
5
2
22
11
26
13
6
24
33
16
29
14
7
3
22
32
16
29
1
36
39
41
0

output:

? 500000000000
? 749999999968
? 874999999952
? 937499999944
? 968749999940
? 984374999938
? 992187499916
? 996093749884
? 998046874868
? 999023437360
? 999511718606
? 999755859229
? 999877929540
? 999938964696
? 999969482274
? 999984741063
? 999992370436
? 999996185123
? 999998092466
? 999999046138
...

result:

ok Queries used: 41

Test #2:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

214
107
722
361
849
1093
1215
1276
638
319
828
414
875
1106
553
945
472
236
786
393
865
432
216
776
388
194
765
1051
525
931
59
1163
1279
0
1308
1322
1329
1333
1335
1336

output:

? 500000000000
? 749999999786
? 874999999679
? 937499998957
? 968749998596
? 984374997747
? 992187496654
? 996093745439
? 998046869163
? 999023431025
? 999511711956
? 999755851753
? 999877921651
? 999938955932
? 999969472404
? 999984730640
? 999992359089
? 999996173314
? 999998080426
? 999999033314
...

result:

ok Queries used: 41

Test #3:

score: 0
Accepted
time: 1ms
memory: 3540kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

output:

? 500000000000
? 750000000000
? 875000000000
? 937500000000
? 968750000000
? 984375000000
? 992187500000
? 996093750000
? 998046875000
? 999023437500
? 999511718750
? 999755859375
? 999877929687
? 999938964843
? 999969482421
? 999984741210
? 999992370604
? 999996185301
? 999998092649
? 999999046323
...

result:

ok Queries used: 40

Test #4:

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

input:

0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
1
0
0
1
0
1
0
0
1
0
1
0
1
1
0
0
0
1
0
1
1

output:

? 500000000000
? 750000000000
? 875000000000
? 937500000000
? 968750000000
? 984375000000
? 992187500000
? 996093750000
? 998046875000
? 999023437500
? 999511718750
? 999755859375
? 999877929686
? 999938964842
? 999969482420
? 999984741209
? 999992370602
? 999996185299
? 999998092646
? 999999046320
...

result:

wrong answer Integer 999999999975 violates the range [999999999976, 1000000000000000001]