QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#561529#9237. Messagebulijiojiodibuliduo#0 0ms0kbC++172.9kb2024-09-12 23:30:142024-09-12 23:30:14

Judging History

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

  • [2024-09-12 23:30:14]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2024-09-12 23:30:14]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef basic_string<int> BI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
const ll mod=1000000007;
//int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

//#define LOCAL
#ifdef LOCAL
void send_message(std::vector<bool> M, std::vector<bool> C);

std::vector<bool> send_packet(std::vector<bool> A);

std::vector<bool> receive_message(std::vector<std::vector<bool>> R);
#else

#include "message.h"

#endif

int blen=1025;
int pad[10100],xbit[10100];
void send_message(std::vector<bool> M, std::vector<bool> C) {
  mt19937 rng(12345); 
  rep(i,0,blen) pad[i]=rng()%2;
  rep(i,0,3000) xbit[i]=rng()%2;
  int m=blen-SZ(M)-1;
  M.pb(pad[m]^1);
  per(i,0,m) M.pb(pad[i]);
  assert(SZ(M)==1025);
  VI gd;
  rep(i,0,31) if (C[i]==0) gd.pb(i);
  int cc=0;
  rep(i,0,64) {
    vector<bool> bs(31,false);
    rep(j,0,16) bs[gd[j]]=M[i*16+j];
    rep(j,0,31) bs[j]=bs[j]^xbit[cc++];
    send_packet(bs);
  }
  rep(i,0,4) {
    vector<bool> bs(31,false);
    rep(j,1,16) bs[gd[j]]=((gd[j]-gd[j-1])>>i)&1;
    if (i==3) bs[gd[0]]=M[blen-1]; else {
      bs[gd[0]]=((gd[0]+31-gd[15])>>i)&1;
    }
    rep(j,0,31) bs[j]=bs[j]^xbit[cc++]; 
    send_packet(bs);
  }
}

int cb[1111],way;
std::vector<bool> receive_message(std::vector<std::vector<bool>> RR) {
  vector<VI> R(SZ(RR),VI(31,0));
  rep(i,0,SZ(R)) rep(j,0,31) R[i][j]=RR[i][j];
  mt19937 rng(12345); 
  rep(i,0,blen) pad[i]=rng()%2;
  rep(i,0,3000) xbit[i]=rng()%2;
  int cc=0;
  VI gd;
  way=0;
  rep(i,0,SZ(R)) rep(j,0,31) R[i][j]=R[i][j]^xbit[cc++];
  function<void(int,int)> dfs=[&](int bit,int dep) {
    if (bit<dep) return;
    if (dep==0) {
      cb[dep]=bit;
      int z=R[64][bit]+(R[65][bit]<<1)+(R[66][bit]<<2);
      if ((cb[0]+31-cb[15])%8==z) {
        //rep(i,0,16) printf("%d ",cb[i]); puts("");
        gd=VI(cb,cb+16);
        way+=1;
      }
    } else {
      cb[dep]=bit;
      int w=R[64][bit]+(R[65][bit]<<1)+(R[66][bit]<<2)+(R[67][bit]<<3);
      if (w!=0) dfs(bit-w,dep-1);
      //dfs(bit-w-8,dep-1);
      dfs(bit-w-16,dep-1);
    }
  };
  per(i,0,31) dfs(i,15);
  assert(way==1);
  vector<bool> seq;
  rep(i,0,64) {
    vector<bool> bs(31,false);
    rep(j,0,16) seq.pb(R[i][gd[j]]);
  }
  seq.pb(R[67][gd[0]]);
  //rep(i,0,SZ(seq)) printf("%d",(int)seq[i]); puts("seq");
  int c=0;
  while (seq.back()==pad[c]) seq.pop_back(),c++;
  seq.pop_back();
  return seq;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Instance #1 Runtime Error

Test #1:

score: 0
Instance #1 Runtime Error

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

0
ing with message 'manual RTE, cant read int from grader'
Quitting with result code 1

result:


Subtask #2:

score: 0
Instance #1 Runtime Error

Test #8:

score: 0
Instance #1 Runtime Error

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

0
ing with message 'manual RTE, cant read int from grader'
Quitting with result code 1

result: