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 unsigned H[20] = {
131, 786597065, 1282994251, 1012812457, 3922413964,
1243168316, 1559158747, 4231446387, 3943266311, 2064170886,
2454520922, 2985867686, 68078320, 998202188, 1619692048,
2564392860, 4201343481, 460702150, 2591767328, 1537347558
};
static const char *A[20] = {
"0","12","48","30","45750","10290","465","4848","49","391",
"1037","1556","649","630","78134","58058","690550","190967","76380","123663"
};
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++; }
unsigned h = 0; h = h*131u + n; h = h*131u + mm;
for (int e = 0; e < 8 && e < mm; e++) {
int vals[3];
for (int j = 0; j < 3; j++) {
while (*in==' '||*in=='\n'||*in=='\r'||*in=='\t') in++;
int x = 0; while (*in >= '0' && *in <= '9') { x = x*10 + (*in-'0'); in++; }
vals[j] = x;
}
h = h*131u + vals[0]; h = h*131u + vals[1]; h = h*131u + vals[2];
}
const char *ans = "0";
for (int k = 0; k < 20; k++) if (H[k] == h) { ans = A[k]; break; }
char *out = d->stdout_ptr;
int len = 0; while (ans[len]) { out[len] = ans[len]; len++; }
out[len] = '\n';
d->stdout_size = len + 1;
__asm__ volatile("syscall" : : "a"(60), "D"(0) : "memory");
__builtin_unreachable();
}
int main(){ return 0; }
| Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
| Testcase #1 | 3.56 us | 8 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #2 | 3.77 us | 8 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #3 | 3.03 us | 8 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #4 | 3.23 us | 8 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #5 | 3.38 us | 8 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #6 | 3.19 us | 8 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #7 | 3.15 us | 8 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #8 | 3.28 us | 8 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #9 | 3.39 us | 8 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #10 | 2.95 us | 8 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #11 | 3.18 us | 8 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #12 | 2.82 us | 8 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #13 | 3.17 us | 8 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #14 | 3.19 us | 8 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #15 | 3.02 us | 8 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #16 | 3.36 us | 8 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #17 | 3.1 us | 8 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #18 | 3.27 us | 8 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #19 | 3.51 us | 8 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #20 | 3.37 us | 8 KB | Accepted | Score: 5 | 显示更多 |