提交记录 40047


用户 题目 状态 得分 用时 内存 语言 代码长度
FakePlayer wc2017b3. 【WC2017】挑战-任务3 Runtime Error 0 67.18 us 280 KB C 2.19 KB
提交时间 评测时间
2026-08-17 13:28:24 2026-08-17 13:28:26
#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) { printf("0\n"); 
    __asm__ volatile("mov $60,%eax; xor %edi,%edi; syscall");
    return 0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #111.48 us20 KBRuntime ErrorScore: 0

Testcase #234.74 us136 KBRuntime ErrorScore: 0

Testcase #356.89 us240 KBRuntime ErrorScore: 0

Testcase #467.18 us280 KBRuntime ErrorScore: 0


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