QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#673938#8726. Magic ShowPhysics2123030 0ms0kbC++171.6kb2024-10-25 11:59:322024-10-25 11:59:32

Judging History

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

  • [2024-10-25 11:59:32]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2024-10-25 11:59:32]
  • 提交

Alice

#include "Alice.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int N=5000;
mt19937 g(time(0)),g2(1e9+9);
uniform_int_distribution<> u(100,200);
inline vector<int> gen(){
  vector<int> p(N);
  iota(p.begin(),p.end(),0);
  shuffle(p.begin(),p.end(),g2);
  return p;
}
vector<pii> Alice(){
  ll X=setN(N);
  vector<pii> e;
  int B=u(g);
  for(int i=3001;i<=N;i++)
    e.emplace_back(i,B+i/62);
  vector<int> v;
  while(X)v.emplace_back(X%B),X/=B;
  for(int i=1501;i<=3000;i++)
    e.emplace_back(i,v.size()+i/63);
  for(int i=501,c=0;i<=1500;i++,c%=v.size())
    e.emplace_back(i,v[c++]+i/64);
  for(int i=2;i<=500;i++)
    e.emplace_back(i,g()%(i-1)+1);
  auto p=gen();
  for(auto &[x,y]:e)
    assert(x<=y),x=p[x-1]+1,y=p[y-1]+1;
  shuffle(e.begin(),e.end(),g);
  return e;
}

Bob

#include "Bob.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int N=5000;
mt19937 g2(1e9+9);
inline vector<int> gen(){
  vector<int> p(N),a(N);
  iota(p.begin(),p.end(),0);
  shuffle(p.begin(),p.end(),g2);
  for(int i=0;i<N;i++)
    a[p[i]]=i;
  return a;
}
ll Bob(vector<pii> e){
  int B=-1,E=-1;
  vector<int> X(N,-1);
  auto p=gen();
  for(auto &[x,y]:e){
    x=p[x-1]+1,y=p[y-1]+1;
    if(x>y)swap(x,y);
    if(y>3000)B=x-y/62;
    else if(y>1500)E=x-y/63;
    else if(y>500)X[y-501]=x-y/64;
  }
  assert(~B&&~E);
  vector<int> v(E);
  for(int i=501;i<=1500;i++)
    if(~X[i-501])v[(i-501)%E]=X[i-501];
  ll c=0,s=1;
  for(int i=0;i<E;i++,s*=B)
    c+=s*v[i];
  return c;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Runtime Error

Test #1:

score: 0
Runtime Error

input:

1
4005

output:


Subtask #2:

score: 0
Runtime Error

Test #13:

score: 0
Runtime Error

input:

1
17476204

output:


Subtask #3:

score: 0
Runtime Error

Test #25:

score: 0
Runtime Error

input:

1
355365355024496523

output: