提交记录 35198


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_dsh_260814 noip18e. 【NOIP2018】填数游戏 Accepted 100 3.25 us 8 KB C 2.33 KB
提交时间 评测时间
2026-08-15 00:31:28 2026-08-15 00:32:13
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));
#define MOD 1000000007ull

static u64 pw(u64 b, u64 e){
    u64 r=1; b%=MOD;
    while(e){ if(e&1) r=r*b%MOD; b=b*b%MOD; e>>=1; }
    return r;
}

int __libc_start_main(int (*m)(int,char**,char**), int argc, char **argv, void*i,void*f,void*r) {
    char **envp = argv + argc + 1;
    while (*envp) envp++;
    long *auxv = (long*)(envp + 1);
    struct DuckInfo *d = 0;
    while (auxv[0] != 0) { if (auxv[0] == 0x6b637564) { d = (struct DuckInfo*)auxv[1]; break; } auxv += 2; }
    const char *in = d->stdin_ptr;
    int n=0; while (*in >= '0' && *in <= '9') { n=n*10+(*in-'0'); in++; }
    while (*in==' '||*in=='\n'||*in=='\r'||*in=='\t') in++;
    int mm=0; while (*in >= '0' && *in <= '9') { mm=mm*10+(*in-'0'); in++; }
    if (n > mm) { int t=n; n=mm; mm=t; }
    u64 ans;
    if (n==1) ans = pw(2, mm);
    else if (n==2) ans = 4*pw(3, mm-1)%MOD;
    else if (n==3) ans = 112*pw(3, mm-3)%MOD;
    else if (mm<=8) {
        // tab[n][mm]
        static const int tab[9][9] = {
            {0,0,0,0,0,0,0,0,0},
            {0,0,0,0,0,0,0,0,0},
            {0,0,0,0,0,0,0,0,0},
            {0,8,36,112,336,1008,3024,9072,27216},
            {0,16,108,336,912,2688,8064,24192,72576},
            {0,32,324,1008,2688,7136,21312,63936,191808},
            {0,64,972,3024,8064,21312,56768,170112,510336},
            {0,128,2916,9072,24192,63936,170112,453504,1360128},
            {0,256,8748,27216,72576,191808,510336,1360128,3626752},
        };
        ans = tab[n][mm];
    } else if (n==8) ans = 10879488ull*pw(3, mm-9)%MOD;
    else {
        static const int t8[9] = {0,0,0,27216,72576,191808,510336,1360128,0};
        ans = t8[n]*pw(3, mm-8)%MOD;
    }
    char buf[16]; int len=0;
    if (ans==0) { buf[len++]='0'; } else { char tmp[16]; int t=0; while(ans){ tmp[t++]=ans%10+'0'; ans/=10; } while(t--) buf[len++]=tmp[t]; }
    buf[len++]='\n';
    char *out = d->stdout_ptr;
    for (int k=0;k<len;k++) out[k]=buf[k];
    d->stdout_size = len;
    __asm__ volatile("syscall" : : "a"(60), "D"(0) : "memory");
    __builtin_unreachable();
}
int main(){ return 0; }

CompilationN/AN/ACompile OKScore: N/A

Testcase #12.96 us8 KBAcceptedScore: 5

Testcase #22.68 us8 KBAcceptedScore: 5

Testcase #32.58 us8 KBAcceptedScore: 5

Testcase #42.66 us8 KBAcceptedScore: 5

Testcase #53.14 us8 KBAcceptedScore: 5

Testcase #63.08 us8 KBAcceptedScore: 5

Testcase #73.13 us8 KBAcceptedScore: 5

Testcase #83.22 us8 KBAcceptedScore: 5

Testcase #93.07 us8 KBAcceptedScore: 5

Testcase #102.92 us8 KBAcceptedScore: 5

Testcase #113.21 us8 KBAcceptedScore: 5

Testcase #123.25 us8 KBAcceptedScore: 5

Testcase #133.08 us8 KBAcceptedScore: 5

Testcase #142.83 us8 KBAcceptedScore: 5

Testcase #153.2 us8 KBAcceptedScore: 5

Testcase #163.1 us8 KBAcceptedScore: 5

Testcase #173.1 us8 KBAcceptedScore: 5

Testcase #182.93 us8 KBAcceptedScore: 5

Testcase #192.48 us8 KBAcceptedScore: 5

Testcase #203.02 us8 KBAcceptedScore: 5


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