提交记录 28334
提交时间 |
评测时间 |
2025-07-10 15:38:25 |
2025-07-10 15:38:27 |
#pragma GCC target("popcnt")
#include<algorithm>
using namespace std;
constexpr int maxn=100000,dim=5,B=64,C=8;
typedef unsigned long long ull;
struct bs
{
ull v[C];
void set(unsigned i){v[i/B]|=1ull<<i%B;}
void andeq(const bs&rhs)
{
#pragma GCC unroll C
for(int i=0;i<C;i++) v[i]&=rhs.v[i];
}
unsigned cnt()
{
unsigned res=0;
#pragma GCC unroll C
for(int i=0;i<C;i++) res+=__builtin_popcountll(v[i]);
return res;
}
}pre[dim][B*C+1];
unsigned seq[B*C+1];
bs *ptr[dim][maxn];
void count_5d(int n,const unsigned *x[5],unsigned *out)
{
for(int i=0;i<maxn;i+=B*C)
{
int r=min(i+B*C,maxn);
seq[r-i]=-1;
for(int j=0;j<dim;j++)
{
for(int k=i;k<r;k++) seq[k-i]=(x[j][k]+1)*B*C+k-i;
sort(seq,seq+r-i);
bs *p=pre[j];
for(int k=0,it=0;k<maxn;k++)
{
if(seq[it]/(B*C)==1u*k)
{
*(p+1)=*p;
p++;
do p->set(seq[it++]%(B*C)); while(seq[it]/(B*C)==1u*k);
}
ptr[j][k]=p;
}
}
for(int j=0;j<maxn;j++)
{
bs tmp=*ptr[0][x[0][j]];
for(int k=1;k<dim;k++) tmp.andeq(*ptr[k][x[k][j]]);
out[j]+=tmp.cnt();
}
}
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 748.025 ms | 4 MB + 372 KB | Accepted | Score: 100 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2025-07-13 21:49:18 | Loaded in 0 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠