QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#226616#5018. nthAdam_GS0 120ms10688kbC++201.4kb2023-10-26 10:48:482023-10-26 10:48:49

Judging History

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

  • [2023-10-26 10:48:49]
  • 评测
  • 测评结果:0
  • 用时:120ms
  • 内存:10688kb
  • [2023-10-26 10:48:48]
  • 提交

answer

#include "nth.h"
#include<bits/stdc++.h>
using namespace std;
namespace Alice {
  bitset<M>A;
	int po, ko, sr, k, l, r;
  bool check(int x) {
    int sum=0;
    for(int i=l; i<=x && i<=r; ++i) if(A[i]) ++sum;
    if(k==1) return sum>=1;
    return sum>=k/2;
  }
  void initA(std::bitset<M> _A,unsigned S,unsigned c) {
    A=_A;
    k=c;
    po=l=0;
    ko=r=M-1;
    sr=(po+ko)/2;
    sendA(check(sr));
  }
	void receiveA(bool x) {
    bool y=check(sr);
    if(!x && !y) po=sr+1;
    else if(x && y) ko=sr;
    else if(y) {
      int sum=k/2;
      while(l<=r && sum) {
        if(A[l]) --sum;
        ++l;
      }
      k-=k/2;
    } else k-=(k+1)/2;
    if(po==ko) {
      report(po);
      return;
    }
    sr=(po+ko)/2;
    sendA(check(sr));
  }
}
namespace Bob {
	bitset<M>B;
  int po, ko, sr, k, l, r;
  bool check(int x) {
    int sum=0;
    for(int i=l; i<=x && i<=r; ++i) if(B[i]) ++sum;
    return sum>=(k+1)/2;
  }
  void initB(std::bitset<M> _B,unsigned S,unsigned c) {
	  B=_B;
    k=c;
    po=l=0;
    ko=r=M-1;
    sr=(po+ko)/2;
  }
	void receiveB(bool x) {
    bool y=check(sr);
    sendB(y);
    if(!x && !y) po=sr+1;
    else if(x && y) ko=sr;
    else if(y) {
      int sum=(k+1)/2;
      while(l<=r && sum) {
        if(B[l]) --sum;
        ++l;
      }
      k-=(k+1)/2;
    } else k-=k/2;
    if(po==ko) {
      report(po);
      return;
    }
    sr=(po+ko)/2;
  }
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 120ms
memory: 10688kb

input:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

3196614622 1048576 82

result:

wrong answer Wrong Answer.