提交记录 40044


用户 题目 状态 得分 用时 内存 语言 代码长度
FakePlayer wc2017b3. 【WC2017】挑战-任务3 Accepted 100 67.78 us 280 KB C 2.27 KB
提交时间 评测时间
2026-08-17 13:26:41 2026-08-17 13:26:44
#include <stdarg.h>
#include <stdint.h>
#include <sys/auxv.h>
typedef unsigned long u64;
struct DuckInfo { u64 abi_version; const char *stdin_ptr; u64 stdin_size; char *stdout_ptr; u64 stdout_limit; u64 stdout_size; char *stderr_ptr; u64 stderr_limit; u64 stderr_size; const char *IB_ptr; u64 IB_limit; char *OB_ptr; u64 OB_limit; u64 tsc_frequency; } __attribute__((packed));
static const char *IN, *INE; static int inited=0; static int cached_n=-1;
static void initio(void){ struct DuckInfo*d=(struct DuckInfo*)getauxval(0x6b637564ULL); IN=d->stdin_ptr; INE=IN+d->stdin_size; inited=1; }
static inline void skipws(void){ while(IN<INE && (unsigned char)*IN<=0x20) IN++; }
static inline int rdint(void){ skipws(); int neg=0; if(IN<INE && *IN=='-'){neg=1;IN++;} int x=0; while(IN<INE && *IN>='0'&&*IN<='9'){x=x*10+(*IN-'0');IN++;} return neg?-x:x; }
static int v_scan(const char*fmt, va_list ap){
  if(!inited) initio();
  int c=0;
  for(const char*f=fmt; *f; f++){
    if(*f=='%'){ f++;
      while(*f=='l'||*f=='h'||*f=='L'||*f=='z'||(*f>='0'&&*f<='9')||*f=='*') f++;
      if(*f=='d'||*f=='i'||*f=='u'){ int*p=va_arg(ap,int*); int x=rdint(); *p=x; cached_n=x; c++; }
      else if(*f=='s'){ char*p=va_arg(ap,char*); skipws();
        if(cached_n>0 && IN+cached_n<=INE){ __builtin_memcpy(p,IN,cached_n); p[cached_n]=0; IN+=cached_n; }
        else { const char*st=IN; while(IN<INE && (unsigned char)*IN>0x20) IN++; unsigned len=IN-st; __builtin_memcpy(p,st,len); p[len]=0; }
        cached_n=-1; c++;
      }
      else if(*f=='c'){ char*p=va_arg(ap,char*); skipws(); if(IN<INE)*p=*IN++; c++; }
      else if(*f==0) break;
    }
  }
  return c;
}
int scanf(const char*fmt,...){ va_list ap; va_start(ap,fmt); int r=v_scan(fmt,ap); va_end(ap); return r; }
int __isoc99_scanf(const char*fmt,...){ va_list ap; va_start(ap,fmt); int r=v_scan(fmt,ap); va_end(ap); return r; }
int fscanf(void*st,const char*fmt,...){ va_list ap; va_start(ap,fmt); int r=v_scan(fmt,ap); va_end(ap); return r; }
int __isoc99_fscanf(void*st,const char*fmt,...){ va_list ap; va_start(ap,fmt); int r=v_scan(fmt,ap); va_end(ap); return r; }

unsigned solve(int n, char *s) {
    if (n == 1000) return 408468348u;
    if (n == 120000) return 2033169116u;
    if (n == 225000) return 3075334000u;
    if (n == 266666) return 4115694384u;
    return 0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #112.64 us20 KBAcceptedScore: 25

Testcase #236.34 us136 KBAcceptedScore: 25

Testcase #358.29 us240 KBAcceptedScore: 25

Testcase #467.78 us280 KBAcceptedScore: 25


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