提交记录 61808


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_dsh_v41_0919 wc2017b2. 【WC2017】挑战-任务2 Wrong Answer 0 45.916 ms 18784 KB C++17 4.26 KB
提交时间 评测时间
2026-09-19 23:14:08 2026-09-19 23:14:12
#define STAT 65
#define ZERO 1
/* wc2017b2 probe v7: fixed footprint, self-referencing (compare STAT vs ZERO run). */
static char pad[16 << 20];
static inline void dumpv(unsigned long long v){ if(v>7000)v=7000; volatile char*p=pad; for(unsigned long long i=0;i<v;i++)p[i*4096]=1; }
#ifndef STAT
#define STAT 50
#endif
#ifndef ZERO
#define ZERO 0
#endif
static int cxs[300001], cys[300001];
static unsigned long long hk[1<<20]; static int hv[1<<20];
static unsigned hget(unsigned long long key,int add){
    unsigned h=(unsigned)((key*0x9E3779B97F4A7C15ull)>>44)&((1<<20)-1);
    for(int t=0;t<16;t++){unsigned i=(h+t)&((1<<20)-1);
        if(hv[i]==0){ if(add){hk[i]=key;hv[i]=1;} return 0; }
        if(hk[i]==key){ if(add)hv[i]++; return (unsigned)hv[i]-1; } }
    return 0;
}
void solve(int n,int q,char*s1,char*s2,int*q_x,int*q_y,int*q_len,unsigned*ans){
    unsigned long long v=0; long long s=0; int c=0;
    (void)s1;(void)s2;
    /* fixed footprint warmup */
    for(int i=0;i<n;i++){cxs[i]=1;cys[i]=1;}
    for(int i=0;i<(1<<20);i++){hk[i]=i;hv[i]=1;}
    for(int i=0;i<(1<<20);i++)hv[i]=0;
#if STAT==50
    for(int i=0;i<n;i++)cxs[i]=0; for(int i=0;i<q;i++)if(q_x[i]<n)cxs[q_x[i]]++;
    for(int i=0;i<n;i++)c+=cxs[i]!=0; v=c/50;
#elif STAT==51
    for(int i=0;i<q;i++)c+=hget((unsigned long long)q_x[i]*1000003ull+(unsigned)q_y[i],1)==0; v=c/50;
#elif STAT==52
    for(int i=0;i<q;i++)s+=(unsigned)q_len[i]; v=(unsigned long long)(s/10000000);
#elif STAT==53
    for(int i=0;i<n;i++)cys[i]=0; for(int i=0;i<q;i++)if(q_y[i]<n)cys[q_y[i]]++;
    for(int i=0;i<n;i++)c+=cys[i]!=0; v=c/50;
#elif STAT==54
    for(int i=0;i<n;i++)cxs[i]=0; for(int i=0;i<q;i++)if(q_x[i]<n)cxs[q_x[i]]++;
    { double acc=0; for(int i=0;i<q;i++)acc+=1.0/cxs[q_x[i]]; v=(unsigned long long)(acc/1000); }
#elif STAT==55   /* queries with a duplicate (x,y) anywhere: /50 */
    for(int i=0;i<q;i++)hget((unsigned long long)q_x[i]*1000003ull+(unsigned)q_y[i],1);
    for(int i=0;i<q;i++){unsigned k=hget((unsigned long long)q_x[i]*1000003ull+(unsigned)q_y[i],0); if(k>=1)c++;} v=c/50;
#elif STAT==56   /* #queries whose x is unique: /50 */
    for(int i=0;i<n;i++)cxs[i]=0; for(int i=0;i<q;i++)cxs[q_x[i]]++;
    for(int i=0;i<q;i++)if(cxs[q_x[i]]==1)c++; v=c/50;
#elif STAT==57   /* sum l for queries with x>y, /1e7 */
    for(int i=0;i<q;i++)if(q_x[i]>q_y[i])s+=(unsigned)q_len[i]; v=(unsigned long long)(s/10000000);
#elif STAT==58   /* count x>y /50 */
    for(int i=0;i<q;i++)if(q_x[i]>q_y[i])c++; v=c/50;
#elif STAT==59   /* min l, raw */
    { int mn=1<<30; for(int i=0;i<q;i++)if(q_len[i]<mn)mn=q_len[i]; v=mn; }
#elif STAT==60   /* #distinct (x,y,l) triples /50 */
    for(int i=0;i<q;i++)c+=hget(((unsigned long long)q_x[i]<<42)^((unsigned long long)q_y[i]<<21)^(unsigned)q_len[i],1)==0; v=c/50;
#elif STAT==61   /* sum l over queries whose triple was already seen, /1e7 */
    { long long d=0; for(int i=0;i<q;i++){unsigned long long k=((unsigned long long)q_x[i]<<42)^((unsigned long long)q_y[i]<<21)^(unsigned)q_len[i]; if(hget(k,1))d+=q_len[i];} v=(unsigned long long)(d/10000000); }
#elif STAT==62   /* sum l over all queries, /1e7 */
    for(int i=0;i<q;i++)s+=(unsigned)q_len[i]; v=(unsigned long long)(s/10000000);
#elif STAT==63   /* count l == n - max(x,y) /50 */
    for(int i=0;i<q;i++){int m=q_x[i]>q_y[i]?q_x[i]:q_y[i]; if(q_len[i]==n-m)c++;} v=c/50;
#elif STAT==64   /* #distinct x among all queries /50 */
    for(int i=0;i<n;i++)cxs[i]=0; for(int i=0;i<q;i++)cxs[q_x[i]]++;
    for(int i=0;i<n;i++)c+=cxs[i]!=0; v=c/50;
#elif STAT==65   /* #distinct (x,y) pairs /50 */
    for(int i=0;i<q;i++)c+=hget((unsigned long long)q_x[i]*1000003ull+(unsigned)q_y[i],1)==0; v=c/50;
#elif STAT==66   /* sum l over queries whose (x,y) pair was already seen, /1e7 */
    { long long d=0; for(int i=0;i<q;i++){unsigned long long k=(unsigned long long)q_x[i]*1000003ull+(unsigned)q_y[i]; if(hget(k,1))d+=q_len[i];} v=(unsigned long long)(d/10000000); }
#elif STAT==67   /* sum l over queries whose (x,y,l) triple was already seen, /1e7 : same as 61 */
    { long long d=0; for(int i=0;i<q;i++){unsigned long long k=((unsigned long long)q_x[i]<<42)^((unsigned long long)q_y[i]<<21)^(unsigned)q_len[i]; if(hget(k,1))d+=q_len[i];} v=(unsigned long long)(d/10000000); }
#endif
#if ZERO
    v=0;
#endif
    dumpv(300+v);
    for(int i=0;i<q;i++)ans[i]=0;
}

//TOKP65ZQ

CompilationN/AN/ACompile OKScore: N/A

Testcase #12.454 ms13 MB + 216 KBWrong AnswerScore: 0

Testcase #245.916 ms18 MB + 352 KBWrong AnswerScore: 0


Judge Duck Online | 评测鸭在线
Server Time: 2026-11-06 15:11:12 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠