QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#126604#5018. nthpandapythoner#0 32ms19656kbC++201.9kb2023-07-18 19:05:532024-07-04 00:44:57

Judging History

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

  • [2024-07-04 00:44:57]
  • 评测
  • 测评结果:0
  • 用时:32ms
  • 内存:19656kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-18 19:05:53]
  • 提交

answer

#include "nth.h"

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define flt double
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

mt19937 rnd(234);
const ll inf = 1e18;

namespace Alice {
bitset<M> A;
vector<int> a;
ll tl, tr;
int cur_bts;

void send_number(int num, int bts = 22) {
    for (int i = 0; i < bts; i += 1) {
        bool x = ((num >> i) & 1);
        sendA(x);
    }
}

void send_binfind() {
    ll tm = (tl + tr) / 2;
    ll cnt = upper_bound(all(a), tm) - a.begin();
    send_number(cnt, cur_bts);
    cur_bts -= 1;
}

void initA(std::bitset<M> _A, unsigned S, unsigned c) {
    A = _A;
    a.clear();
    for (int i = 0; i < M; i += 1) {
        if (A[i]) {
            a.push_back(i);
        }
    }
    cur_bts = 23;
    tl = -1;
    tr = M;
    send_binfind();
}

void receiveA(bool x) {
    ll tm = (tl + tr) / 2;
    if (x) {
        tr = tm;
    } else {
        tl = tm;
    }
    send_binfind();
}
}  // namespace Alice

namespace Bob {
int q;
int cur_bts;
int cur_cnt;
int rc;
std::bitset<M> B;
vector<int> b;
ll tl, tr;

void initB(std::bitset<M> _B, unsigned S, unsigned c) {
    B = _B;
    rc = c;
    for (int i = 0; i < M; i += 1) {
        if (B[i]) {
            b.push_back(i);
        }
    }
    q = 0;
    cur_bts = 23;
    cur_cnt = 0;
    tl = -1;
    tr = M - 1;
}

void receiveB(bool x) {
    if (x) {
        cur_cnt += (1 << q);
    }
    q += 1;
    if (q == cur_bts) {
        int cnt = cur_cnt;
        int tm = (tl + tr) / 2;
        cnt += upper_bound(all(b), tm) - b.begin();
        if (cnt >= rc) {
            tr = tm;
            sendB(true);
        } else {
            tl = tm;
            sendB(false);
        }
        q = 0;
        cur_cnt = 0;
        cur_bts -= 1;
    }
    if (tl + 1 == tr) {
        report(tr);
    }
}
}  // namespace Bob

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 42
Acceptable Answer
time: 32ms
memory: 19656kb

input:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

3196614622 1083345 294

result:

points 0.420 OK L = 294

Test #2:

score: 0
Wrong Answer
time: 29ms
memory: 14308kb

input:

111111100101001001100100000000111110101000101001001100101010011110000110101011010000000001000111000001011011110101010111001101010000101001101011101001110011001001101111110100001111001001010000110000011011000101010010000000011010010111110000111011011100110000100101111000111111110001100110110111101001...

output:

4153393124 327679 294

result:

wrong answer Wrong Answer.