QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#126603 | #5018. nth | pandapythoner# | 0 | 31ms | 20928kb | C++20 | 1.9kb | 2023-07-18 19:05:01 | 2024-07-04 00:44:57 |
Judging History
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 = 22;
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 = 22;
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: 22ms
memory: 20928kb
input:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
3196614622 1083345 273
result:
points 0.420 OK L = 273
Test #2:
score: 0
Wrong Answer
time: 31ms
memory: 14128kb
input:
111111100101001001100100000000111110101000101001001100101010011110000110101011010000000001000111000001011011110101010111001101010000101001101011101001110011001001101111110100001111001001010000110000011011000101010010000000011010010111110000111011011100110000100101111000111111110001100110110111101001...
output:
4153393124 327679 273
result:
wrong answer Wrong Answer.