可爱的小 F
idea & solution:chengyifan91。
简述题意
请你输出一个小猫咪。合理利用“可爱的网址”。
题解
找到【比赛说明】中的胡言乱语,点击最后一个“可爱的网址”,点击“举报用户套取数据抢最优解”,滑到最下面,点击“复制标准代码并提交”,将复制的小猫咪提交即可获得满分。
脑操
idea:很多人。
solution:chengyifan91。
本题在很久之前就被出出来了,chengyifan91 感觉非常愚人节,就放到比赛里了。
简述题意
自己滚去看题。
题解
黄色为教学,蓝色或红色为任务,红色表示比较难。
仅讲解大致思路,不保证你能看懂。
任务 1
输入一个数 ,输出 。
这并不困难,我们可以将非运算转换为 运算。
具体的,先在一个空地 ,然后我们判断如果有值就将空地的 清空,并把 清零防止继续循环。
AC code:,>+<[>-<[-]]>.。
转移值
如果你要将 位置的值全部加到 上,你可以:[->+<]。
含义很好理解,就是让 减 ,让 加 ,直到 。
任务 2
输入两个数 ,输出 。
这也不是难事,把 的值转移到 就行了。
AC code:,>,[-<+>]<.
感觉没有任务 难,不知为何把他放到非运算后面了。
任务 3
把加法转移改一下符号就行啦。
AC code:,>,[-<->]<.
复制值
如何将 的值转移到 ,且让 的值还保留?
我们可以先复制出两份 。
[->+>+<<]
然后把 转移回 。
>>[-<<+>>]
总体代码:[->+>+<<]>>[-<<+>>]
任务 4
乘法,即多次加法运算。
我们可以判断,如果 还有值,说明结果还需要加一个 。
变量排布:[b][a][0][res]。
这里的 0 用于复制。
AC code:,>,[->[->+>+<<]>[-<+>]<<]>>>.。
小于号
输入两个数 ,判断 。
我们可以让他们依次 , 取 ,如果最后 还有值说明 ,也就是 。
变量排布:[0][a][b][0]
这里的 0 用于结束循环,[<] 表示移动到 左侧最后一个为 的位置。
,>,<[>[->]<<[<]>-]>[>+<[-]]>.
任务 5
这个相较上一个略显复杂。
我们可以枚举 从 到 ,依次 ,然后存储 和
下面是 的一个例子。
| a | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|
| 2 | 1 | 0 | 1 | 0 | 1 | 0 |
注意到我们只需要在 时加答案即可。
排布:[res][a][0][t%b][(b-t)%b]
存储的是非 ,res 初始时 是为了方便找 的位置。
AC code:,>>>,<<<<+>[>+>+>-[<<-]<<[<]>>>[-<<+>>>[->+<]<]<-]<-.
这份代码很短,但是花费不是很优,感兴趣可以尝试优化。
任务 6
注意看除法的代码,我们已经求了 了,然而 最后就是 ,这就是答案。
AC code:,>>>,<<<<+>[>+>+>-[<<-]<<[<]>>>[->[->+<]<]<-]>>.
任务 7
songtaoran:合理利用题目的输入 性质。
我们可以将每个数 ,就避免了有 的情况。
[n/k][a1+1][a2+1][a3+1]...[an+1]
先把这些数输入进来
,[[>],+[<]>-]
然后考虑 如何处理,我们可以把 放到最右侧,然后每一次把最左侧清空(输入 然后 )
>[>],[[<]>.,+>[>]<-]
拼起来
AC code:,[[>],+[<]>-]>[>],[[<]>-.,+>[>]<-]
任务 8
不难发现我们只需要分段,然后将最后一个数清零即可!注意第一个数单独分一段,然后分 个长度为 的段。
,[->+>+<<]>>[-<<+>>].,<<-[->[->+>,.<<]>[-<+>].>,<<<]
最大值
两个数取 。
注意到 。
也就是说,我们只需要让 不断地减 直到 或者 被减完。最后加一个 。
变量排布:
[0][a][a][b]
,>>,<<[>+>[->]<<[<]>-]>[->+<]>.
取 怎么办呢?
注意到 ,然后反过来让 就可以了。
变量排布:
[0][b][a][a]
,[-<+<+>>]<<<,[>>[->]<<[<]>-]>>[-<->]<.
稍微比 max 长一点,不过也是可接受的。
任务 9
很有难度了。
首先先考虑只有 min 怎么办。
输入 个数,依次和之前的 mn 取 min。
变量排布:[n][0][x][mn][mn]
,[->+>>>+>+<<<<<]>[->>,[>>[->]<<[<]>-]>>[-<->]<[-<+>]<[->+>+<<]<<]只有最大值又怎么办?
变量排布:[n][0][mx][mx][x]
,[->>>>,<<[>+>[->]<<[<]>-]>[->+<]>[-<<+>>]<<<<]然后,我们需要将其巧妙地结合起来。
变量排布:[n][0][mx][mx][x][0][x][mn][mn]
,[-<+>]<[->+>>>>>>>+>+<<<<<<<<<]>[->>>>,[->+>+<<]>[-<+>]<<<[>+>[->]<<[<]>-]>[->+<]>[-<<+>>]>>[>>[->]<<[<]>-]>>[-<->]<[-<+>]<[->+>+<<]<<<<<<<<]>>.>>>>>.任务 里最难的题,没有之一。
注:该任务有另一种好写且好想的做法,留给读者自行思考。
任务 10
不如任务 9。
枚举 ,然后答案加上 即可。
,[->+>+<<]>>[-<<+>>]<[->>+<<]>>[-<<<[<+>>+>+>-[<<-]<<[<]>>>[->[->+<]<]<-]>>[<]>>>+>[>]<<<<[->+<]<<<[->+<]>>>>]>>.任务 11
首先我们想办法把 搞出来。
暴力写 个 - 肯定行不通,然后倍增也比较难写,下面提供一个办法。
是用动态规划求出最少字符数量,考虑 表示搞出 的最少字符数量。
这里只提供两种转移,感兴趣可以再想想别的:
- 直接
+: - 乘法:我们可以使用
[+> x 个 -<]>来完成简易的乘法,需要 个字符。。
然后 1. 随便写一个优化 dp 就好了,比较基础不做讲解。2. 就正常转移,复杂度 ,这里只提供 C++ 代码。
#include<bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int dp[N], lst[N], op[N], num[N], p[N];
void dfs(int x) {
if (x == 0) return ;
if (op[x] == 0) {
dfs(lst[x]);
for (int i = 1; i <= x-lst[x]; i++) cout << "+";
} else {
dfs(lst[x]);
cout << "[->";
for (int i = 1; i <= x/lst[x]; i++) cout << "+";
cout << "<]>";
}
}
int main() {
memset(dp, 0x3f, sizeof(dp));
memset(num, 0x3f, sizeof(num));
dp[0] = 0;
int mn = 0, id = 0;
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
if (mn+i < dp[i]) lst[i] = id, dp[i] = mn+i, op[i] = 0;
if (num[i] < dp[i]) lst[i] = p[i], dp[i] = num[i], op[i] = 1;
for (int j = i; j <= n; j += i) num[j] = min(num[j], dp[i]+6+j/i), p[j] = (num[j]==dp[i]+6+j/i?i:p[j]);
if (dp[i]-i < mn) id = i, mn = dp[i]-i;
}
dfs(n);
cout << ".";
return 0;
}跑出来发现是这样的:
---------[+>--------<]>-[+>--------<]>[+>----<]>-[+>-------<]>[+>-------<]>-先放到一边。
然后随便写一个加和
,[[>],+[<]>-]>[>],-[[<]>-[->+<]>[>]<-]<[<]>.结合起来
,[[>],+[<]>-]>[>],-[[<]>-[->+<]>[>]<-]<[<]<<<<---------[+>--------<]>-[+>--------<]>[+>----<]>-[+>-------<]>[+>-------<]>-任务 12
首先读入 和 个数,太简单不说了。
变量排布:[q][n][l/r][a1+2][0][a2+2]...
,<,>[[>>],++[<<]>>-]<
然后开始处理主要问题,由于值域太大,差分肯定不行,此时我们可以让前 个数 ,前 个数 。
前缀 +
,-[->+<[->>+<<]>>]<[<<]>
前缀 -
,[->-<[->>+<<]>>]<[<<]>
结合起来
,<,>[[>>],++[<<]>>-]<[->>,-[->-<[->>+<<]>>]<[<<]>,[->+<[->>+<<]>>]<[<<]<]>>>[--.>>]任务 13
我们考虑让第一个数和 比较,这样一定会产生一个答案,然后就不用特判了。
变量排布:[n][now][0][lst][res]
,[->,[->+>-<<]>>[>+>]<<[<]>[-<+>>+<]>[-]<<[->>+<<]<]>>>>.
任务 14
考虑开一个桶。
[n][ai][mp1+1][0][mp2+1][0]...[mp_n+1]
初始化
,[->+>+<<]>[[>>]+[<<]>>-]>[-<+>]<
然后是对 更新桶
,[-[->>+<<]>>]<+[<<]>
最后是统计答案
>>[-[>+<[-]]>[->>+<<]>]>.
写在一起:
,[->+>+<<]>[[>>]+[<<]>>-]>[-<+>]<[>,[-[->>+<<]>>]<+[<<]>>-]>>[-[>+<[-]]>[->>+<<]>]>.
任务 15
桶排复杂度小,还好写,何尝不写桶排呢?
依旧先开桶
,[->+>+<<]>[[>>]+[<<]>>-]>[-<+>]<[>,[-[->>+<<]>>]<+[<<]>>-]然后写一个输出即可, 存下标。
>>>+<[-[->.<]>+[->>+<<]>]结合起来
,[->+>+<<]>[[>>]+[<<]>>-]>[-<+>]<[>,[-[->>+<<]>>]<+[<<]>>-]>>>+<[-[->.<]>+[->>+<<]>]任务 16
还是先开桶
,[->+>+<<]>[[>>]+[<<]>>-]>[-<+>]<[>,[-[->>+<<]>>]<+[<<]>>-]然后一直跳直到找到一个非 位置
>>[>>]<<[-<<]>>>+<[>+[->>+<<]>]>.写在一起
,[->+>+<<]>[[>>]+[<<]>>-]>[-<+>]<[>,[-[->>+<<]>>]<+[<<]>>-]>>[>>]<<[-<<]>>>+<[>+[->>+<<]>]>.开桶多美好啊!
任务 17
Cybher 推荐的题目。困难,但可以屎一屎。
首先提供一个简单的 C++ lca 写法(暴力跳):
int tu = u, tv = v;
while (u != v) {
u = fa[u] ? fa[u] : tv, v = fa[v] ? fa[v] : tu;
}不难发现他们都会走过同样的路程,最终一定会在 lca 停下。
先随便写一个输入
,[>[>>],+[<<]>-]
考虑我们怎么处理 u = fa[u] ? fa[u] : tv, v = fa[v] ? fa[v] : tu;。
先写成
u = fa[u], v = fa[v];
if (!u) u = tv;
if (!v) v = tu;考虑怎么处理后两句。
假设当前的布局是这样的:
[u][tv][tu][v]
u: [>[-<<+>>]]<<[<]>>>[-<+<+>>]<<[->>+<<]
v: >>>>[<[->>+<<]]>>[>]<<<[->+>+<<]>>[-<<+>>]
写在一起就是这样的:
[>[-<<+>>]]<<[<]>>>[-<+<+>>]<<[->>+<<]>>>>[<[->>+<<]]>>[>]<<<[->+>+<<]>>[-<<+>>]<这里的终止位置是 v。
然后就是第一句了,先写一个优秀的寻址,能够将 的值带回来。
变量排布
[0][i][a1+1][0][a2+1][0][a3+1]
然后假设当前位置存的是 要把 带回来放在 的位置上
[-[->>+<<]>>]<[-<+>]<[->+>+<<]>[>[-<<+>>]<<<]>-
然后就是 while 的条件了。
[-<<<-<+>>>>]<<<[<[->+>>>+<<<<] 这里写主体 ]
为了防止写两遍上面的东西,我们可以:
int t = 2;
while (t--) {
swap(u, v);
对 u 做一些事情 ...
}然后就可以拼接起来,先输入 ,然后是 ,接下来就做上面的事情。
,[>[>>],+[<<]>-]<<<<<,[->+>+<<]>[-<+>]>>,[-<<+<<+>>>>]<<<<[->>>>+<<<<]>>>>[-<<<-<+>>>>]<<<[<[->+>>>+<<<<]++[->>>>[->>+<<]>>[-[->>+<<]>>]<[-<+>]<[->+>+<<]>[>[-<<+>>]<<<]>-<<<<<[->>>+<<<]>>>>>[-<<<<<+>>>>>]<<<<<<]>[>[-<<+>>]]<<[<]>>>[-<+<+>>]<<[->>+<<]>>>>[<[->>+<<]]>>[>]<<<[->+>+<<]>>[-<<+>>]<[-<<<-<+>>>>]<<<]<.全题最难任务。
树从树变成了图然后求最大值问题
idea & solution & grader:chengyifan91。
最多就是黄题,但是赛时大多数人没做出来。
简述题意
滚去看题。
题解
Alice
我们先让 Alice 求出答案 ,由于 ,因此我们可以连出 个自环。
Bob
查询自环数量。
交互库
#include <bits/stdc++.h>
#include <unistd.h> // pipe, fork, read, write, close, _exit (POSIX)
#include <sys/wait.h> // waitpid
#include <dirent.h> // For opendir, readdir, closedir
#include <fcntl.h> // For fcntl (though not directly used in example below)
#include <sched.h> // For unshare() and CLONE_NEWIPC
#include <sys/resource.h>
// --- Headers needed for seccomp-bpf ---
#include <errno.h>
#include <stddef.h> // For offsetof
#include <sys/prctl.h> // For prctl()
#include <sys/syscall.h> // For __NR_ syscall numbers
#include <linux/audit.h> // For AUDIT_ARCH constants
#include <linux/filter.h> // For BPF filter code
#include <linux/seccomp.h> // For SECCOMP_MODE_FILTER etc.
// --- Seccomp Filter Setup (Исправлено) ---
// Check architecture (Остается без изменений)
#if defined(__x86_64__)
#define ARCH_NR AUDIT_ARCH_X86_64
#elif defined(__i386__)
#define ARCH_NR AUDIT_ARCH_I386
#elif defined(__aarch64__)
#define ARCH_NR AUDIT_ARCH_AARCH64
#elif defined(__arm__)
#define ARCH_NR AUDIT_ARCH_ARM
#else
#warning "Target architecture is not explicitly supported by seccomp filter's arch check."
#define ARCH_NR AUDIT_ARCH_X86_64 // Default guess, may fail
#endif
// Define BPF filter to block specific System V IPC syscalls ONLY
struct sock_filter ipc_block_filter[] = {
// Validate architecture
BPF_STMT(BPF_LD | BPF_W | BPF_ABS, (offsetof(struct seccomp_data, arch))),
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, ARCH_NR, 1, 0), // Check arch, jump if correct
BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_KILL), // Kill if arch is wrong
// Load syscall number
BPF_STMT(BPF_LD | BPF_W | BPF_ABS, (offsetof(struct seccomp_data, nr))),
// --- Disallow System V Shared Memory ---
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, __NR_shmget, 0, 1),
BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ERRNO | EPERM),
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, __NR_shmat, 0, 1),
BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ERRNO | EPERM),
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, __NR_shmdt, 0, 1),
BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ERRNO | EPERM),
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, __NR_shmctl, 0, 1),
BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ERRNO | EPERM),
// --- 新增:禁止 POSIX Message Queues ---
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, __NR_mq_open, 0, 1),
BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ERRNO | EPERM),
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, __NR_mq_timedsend, 0, 1), // mq_send() 通常使用此系统调用
BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ERRNO | EPERM),
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, __NR_mq_timedreceive, 0, 1), // mq_receive() 通常使用此系统调用
BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ERRNO | EPERM),
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, __NR_mq_unlink, 0, 1),
BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ERRNO | EPERM),
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, __NR_mq_notify, 0, 1),
BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ERRNO | EPERM),
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, __NR_mq_getsetattr, 0, 1),
BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ERRNO | EPERM),
// --- 新增:禁止 fork, clone, clone3 ---
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, __NR_fork, 0, 1),
BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ERRNO | EPERM),
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, __NR_clone, 0, 1),
BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ERRNO | EPERM),
#ifdef __NR_clone3 // clone3 可能并非在所有头文件中都定义
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, __NR_clone3, 0, 1),
BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ERRNO | EPERM),
#endif
// --- 新增:禁止 memfd_create ---
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, __NR_memfd_create, 0, 1),
BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ERRNO | EPERM),
// --- POSIX Shared Memory checks removed as they don't compile ---
// --- Allow all other syscalls ---
BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ALLOW),
};
// Обновляем программу фильтра с новым размером
struct sock_fprog ipc_block_prog = {
.len = (unsigned short)(sizeof(ipc_block_filter) / sizeof(ipc_block_filter[0])),
.filter = ipc_block_filter,
};
// Функция apply_ipc_seccomp_filter() остается без изменений
bool apply_ipc_seccomp_filter() {
if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) == -1) { return false; }
if (prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &ipc_block_prog) == -1) { return false; }
return true;
}
// --- End Seccomp Filter Setup ---
void Alice(int n, int u, int v, std::vector<int> f, std::vector<int> a);
int Bob(int n, int u, int v);
// 辅助函数:向管道安全地写入数据
bool write_to_pipe(int fd, const void* data, size_t size) {
size_t total_written = 0;
const char* buffer = static_cast<const char*>(data);
while (total_written < size) {
ssize_t written = write(fd, buffer + total_written, size - total_written);
if (written < 0) {
// perror("write to pipe"); // 子进程中不建议直接输出到 stderr 干扰评测机
return false;
}
// write 返回 0 通常意味着 count 参数为 0,或者对于某些类型的文件描述符是EOF,
// 但对于管道,如果 count > 0,返回 0 是很罕见的,通常表示错误。
// 然而,如果写入 0 字节是成功的,下面的检查会错误地将其视为失败。
// 对于阻塞管道和 size > 0,write 不应返回 0 除非发生错误(此时应返回 -1)。
// 因此,主要依赖 written < 0 来捕获错误。
// if (written == 0 && (size - total_written) > 0) { // 严格来说,如果 size > 0,write 不应返回 0
// return false;
// }
total_written += written;
}
return true;
}
// 辅助函数:从管道安全地读取数据
bool read_from_pipe(int fd, void* data, size_t size) {
size_t total_read = 0;
char* buffer = static_cast<char*>(data);
while (total_read < size) {
ssize_t bytes = read(fd, buffer + total_read, size - total_read);
if (bytes < 0) {
// perror("read from pipe");
return false;
}
if (bytes == 0) { // EOF (管道另一端已关闭且所有数据已读取)
return false; // 在读取完期望的字节数之前遇到了EOF
}
total_read += bytes;
}
return true;
}
// pipe_for_child_to_write 是子进程需要与父进程通信的文件描述符
// 该函数需在子进程中运行。
void sanitize_child_fds_comprehensively(int pipe_for_child_to_write) {
// 将 STDIN、STDOUT、STDERR 重定向到 /dev/null
int dev_null_fd_read = open("/dev/null", O_RDONLY);
if (dev_null_fd_read == -1) { _exit(EXIT_FAILURE); }
if (dup2(dev_null_fd_read, STDIN_FILENO) == -1) { _exit(EXIT_FAILURE); }
close(dev_null_fd_read);
int dev_null_fd_write = open("/dev/null", O_WRONLY);
if (dev_null_fd_write == -1) { _exit(EXIT_FAILURE); }
if (dup2(dev_null_fd_write, STDOUT_FILENO) == -1) { _exit(EXIT_FAILURE); }
if (dup2(dev_null_fd_write, STDERR_FILENO) == -1) { _exit(EXIT_FAILURE); }
close(dev_null_fd_write);
long max_fd = sysconf(_SC_OPEN_MAX);
for (int fd = STDERR_FILENO + 1; fd < max_fd; ++fd) {
if (fd != pipe_for_child_to_write) { // 不要关闭必要管道!
close(fd);
}
}
}
namespace {
int link_count = 0, get_count = 0, state = 0, n;
const int N = 1010;
bool g[N][N];
int pipe_A_to_P[2], pipe_B_to_P[2], now[N];
}
void Link(int u, int v) {
if (state == 2) {
close(pipe_B_to_P[1]);
_exit(EXIT_FAILURE);
}
if (u < 0 || u >= n || v < 0 || v >= n) {
close(pipe_A_to_P[1]);
_exit(EXIT_FAILURE);
}
if (g[u][v]) {
close(pipe_A_to_P[1]);
_exit(EXIT_FAILURE);
}
if (++link_count > 5000) {
close(pipe_A_to_P[1]);
_exit(EXIT_FAILURE);
}
g[u][v] = g[v][u] = 1;
}
bool Get(int u, int v) {
if (state == 1) {
close(pipe_A_to_P[1]);
_exit(EXIT_FAILURE);
}
if (u < 0 || u >= n || v < 0 || v >= n) {
close(pipe_B_to_P[1]);
_exit(EXIT_FAILURE);
}
if (++get_count > 5000) {
close(pipe_B_to_P[1]);
_exit(EXIT_FAILURE);
}
return g[now[u]][now[v]];
}
int main() {
int u, v;
std::cin >> n >> u >> v;
if (n < 0 || n > 1000) {
std::cout << "Failed" << std::endl;
return 0;
}
if (u < 0 || u >= n || v < 0 || v >= n) {
std::cout << "Failed" << std::endl;
return 0;
}
std::vector<int> a(n), f(n);
std::mt19937 rnd(114514+6578);
for (int i = 0; i < n; i++) std::cin >> f[i];
for (int i = 0; i < n; i++) std::cin >> a[i];
if (f[0] != -1) {
std::cout << "Failed" << std::endl;
return 0;
}
for (int i = 1; i < n; i++) {
if (f[i] < 0 || f[i] >= i) {
std::cout << "Failed" << std::endl;
return 0;
}
}
for (int i = 0; i < n; i++) {
if (a[i] < 1 || a[i] > n) {
std::cout << "Failed" << std::endl;
return 0;
}
}
for (int i = 0; i < n; i++) now[i] = i;
for (int i = 0; i < n; i++) std::swap(now[i], now[rnd() % n]);
int alice_val_x = -1;
if (pipe(pipe_A_to_P) == -1) {
perror("Grader Error creating pipe for Alice"); // 这个错误更可能是评分器本身的问题
std::cout << "Failed" << std::endl; // 但按题目要求,交互错误也输出WA
return 0;
}
pid_t pid_A = fork();
if (pid_A == -1) {
perror("Grader Error fork for Alice failed");
std::cout << "Failed" << std::endl;
close(pipe_A_to_P[0]);
close(pipe_A_to_P[1]);
return 0;
}
if (pid_A == 0) { // Alice 子进程
state = 1;
close(pipe_A_to_P[0]); // Alice 只写入
sanitize_child_fds_comprehensively(pipe_A_to_P[1]);
apply_ipc_seccomp_filter();
Alice(n, u, v, f, a); // 调用用户的 Alice 函数
if (!write_to_pipe(pipe_A_to_P[1], g, sizeof(g))) {
// 写入管道错误
close(pipe_A_to_P[1]);
_exit(EXIT_FAILURE); // 向父进程指示错误 (使用 _exit 避免刷新 stdio 缓冲区)
}
close(pipe_A_to_P[1]);
_exit(EXIT_SUCCESS);
} else { // 父进程
close(pipe_A_to_P[1]); // 父进程只从 Alice 读取
bool alice_read_ok = read_from_pipe(pipe_A_to_P[0], g, sizeof(g));
int status_A;
waitpid(pid_A, &status_A, 0); // 等待 Alice 进程结束
bool alice_comm_ok = true;
if (WIFEXITED(status_A)) { // Alice 进程正常退出
if (WEXITSTATUS(status_A) != EXIT_SUCCESS) { // Alice 返回了非0退出码
alice_comm_ok = false;
} else { // Alice 返回0,尝试读取数据
if (!alice_read_ok) {
alice_comm_ok = false; // 从管道读取数据失败
}
}
} else { // Alice 进程异常终止 (例如,崩溃)
alice_comm_ok = false;
}
close(pipe_A_to_P[0]); // 关闭读端
if (!alice_comm_ok) {
std::cout << "Failed" << std::endl;
return 0;
}
}
// Alice 执行完毕且返回值X有效,现在运行 Bob 进程
int bob_val_p = -1;
if (pipe(pipe_B_to_P) == -1) {
perror("Grader Error creating pipe for Bob");
std::cout << "Failed" << std::endl;
return 0;
}
pid_t pid_B = fork();
if (pid_B == -1) {
perror("Grader Error fork for Bob failed");
std::cout << "Failed" << std::endl;
close(pipe_B_to_P[0]);
close(pipe_B_to_P[1]);
return 0;
}
if (pid_B == 0) { // Bob 子进程
state = 2;
close(pipe_B_to_P[0]); // Bob 只写入
sanitize_child_fds_comprehensively(pipe_B_to_P[1]);
apply_ipc_seccomp_filter();
int result_p = Bob(n, u, v); // 调用用户的 Bob 函数
if (!write_to_pipe(pipe_B_to_P[1], &result_p, sizeof(result_p))) {
close(pipe_B_to_P[1]);
_exit(EXIT_FAILURE);
}
close(pipe_B_to_P[1]);
_exit(EXIT_SUCCESS);
} else { // 父进程
close(pipe_B_to_P[1]); // 父进程只从 Bob 读取
int status_B;
waitpid(pid_B, &status_B, 0); // 等待 Bob 进程结束
bool bob_comm_ok = true;
if (WIFEXITED(status_B)) {
if (WEXITSTATUS(status_B) != EXIT_SUCCESS) {
bob_comm_ok = false;
} else {
if (!read_from_pipe(pipe_B_to_P[0], &bob_val_p, sizeof(bob_val_p))) {
bob_comm_ok = false;
}
}
} else {
bob_comm_ok = false;
}
close(pipe_B_to_P[0]);
if (!bob_comm_ok) {
std::cout << "Failed" << std::endl;
return 0;
}
// 计算答案
std::vector<int> dep(n);
int ans = 0;
for (int i = 1; i < n; i++) dep[i] = dep[f[i]] + 1;
if (dep[u] < dep[v]) std::swap(u, v);
while (dep[u] > dep[v]) ans = std::max(ans, a[u]), u = f[u];
while (u != v) ans = std::max({ans, a[u], a[v]}), u = f[u], v = f[v];
ans = std::max(ans, a[u]);
if (ans != bob_val_p) {
std::cout << "WA" << std::endl;
} else {
std::cout << "April Fools' Day!" << std::endl;
}
}
return 0;
}合一合
idea & solution & checker:chengyifan91。
咋这么多人连题都没读懂。
chengyifan91 这个唐氏一开始把 checker 下发了,让 _endl_ 过了。
简述题意
你需要用金木水火土合成出魔法少女网站。
题解
两个隐藏物品是将军和追忆,至于合成方法去看 checker。
checker
#include<bits/stdc++.h>
#include"testlib.h"
#define str(x) #x
#define add(a, b, c) mp[str(a##b)] = mp[str(b##a)] = str(c)
using namespace std;
map<string, string> mp;
void init_table() {
add(00100, 01000, 00011);
add(00010, 00100, 00101);
add(00100, 10000, 00110);
add(00010, 01000, 01001);
add(00100, 00100, 01010);
add(01000, 01000, 01100);
add(00001, 01000, 10001);
add(00001, 00001, 10010);
add(10000, 10000, 10100);
add(10000, 00011, 10100);
add(01010, 01100, 11000);
add(00101, 00110, 11000);
add(10010, 11000, 00111);
add(11000, 01010, 01011);
add(11000, 00110, 01011);
add(01100, 10101, 01101);
add(11000, 11000, 01110);
add(11000, 00111, 01110);
add(01110, 00111, 10011);
add(01100, 11000, 10101);
add(00011, 11000, 10101);
add(01011, 10101, 11001);
add(11000, 01011, 11010);
add(11001, 00101, 11100);
add(11010, 11100, 01111);
add(01011, 11100, 01111);
add(00111, 00111, 10111);
add(01111, 10111, 11011);
add(10011, 00111, 11101);
add(00100, 11010, 11110);
add(11011, 11101, 11111);
}
int main(int argc, char* argv[]) {
registerTestlibCmd(argc, argv);
init_table();
int t = ans.readInt();
map<string, bool> mp2;
mp2["00000"] = mp2["00001"] = mp2["00010"] = mp2["00100"] = mp2["01000"] = mp2["10000"] = 1;
string lst = "00000";
int score = 0;
while (!ouf.eof()) {
string s = ouf.readLine();
while (!s.empty() && s.back() == ' ') s.pop_back();
if (s.size() != 11) quitf(_wa, "Failed");
string a, b, c;
if (s[5] != ' ') quitf(_wa, "Failed");
for (int i = 0; i < 5; i++) {
if (s[i] != '0' && s[i] != '1') quitf(_wa, "Failed");
a += s[i];
}
for (int i = 6; i < 11; i++) {
if (s[i] != '0' && s[i] != '1') quitf(_wa, "Failed");
b += s[i];
}
if (!mp2.count(a) || !mp2.count(b)) quitf(_wa, "Failed");
if (a == "00000") c = b;
else if (b == "00000") c = a;
else {
if (!mp.count(a+b)) quitf(_wa, "Failed");
c = mp[a+b];
}
if (mp2.count(c)) quitf(_wa, "Failed");
mp2[c] = 1;
if (c == "01101" || c == "11110") {
if (score == 15) score = 30;
else score = 15;
}
lst = c;
}
if (t <= 5) {
if (lst[t-1] == '1') quitf(_ok, "%d: 1", t);
else quitf(_wa, "%d: 0", t);
} else {
if (score == 0) quitf(_wa, "You did not find the hidden item.");
if (score == 15) quitp(0.5, "You found 1 hidden item.");
if (score == 30) quitf(_ok, "You found all the hidden items.");
}
return 0;
}
可爱的谜题
idea & solution:Cybher。
简述题意
懒得简述了,自己去看题。
题解
题解丢失
额,由于这题不是我出的,题解去管 Cybher 要吧。
可爱的谜题 II
idea & solution:Cybher。
checker:chengyifan91。
由于题目中的图片是由纸上转过来的,然而第五行的 实际上在纸上写的是 ,不过依然有解法,并且原先的解法也能过,那无所谓了。
简述题意
懒得简述了,自己去看题。
题解
题解丢失
额,由于这题不是我出的,题解去管 Cybher 要吧。
checker
#include "testlib.h"
#include <bits/stdc++.h>
using namespace std;
const int n = 10;
const int m = 10;
// 原图(完全按你图片手填)
string op[n][m] = {
{"", "", "", "", "+10", "", "", "*7", "/3", ""},
{"", "", "*0", "", "", "", "", "", "-7", ""},
{"", "*0", "", "+3", "", "", "", "+5", "*0", ""},
{"", "", "/3", "", "", "/3", "", "", "", "*0"},
{"*0", "", "+7", "", "", "", "", "", "", ""},
{"+0","+0","+0","+0","+0","+0","+0","+0","+0","+0"},
{"*0","/7","", "/2","", "", "", "", "/2",""},
{"", "*3","", "", "*0","", "/4","", "", ""},
{"", "", "*0","", "*0","", "", "", "+7",""},
{"", "", "", "", "", "", "", "", "", ""}
};
// 方向
int dx[256], dy[256];
int main(int argc, char* argv[]) {
registerTestlibCmd(argc, argv);
dx['>'] = 0; dy['>'] = 1;
dx['<'] = 0; dy['<'] = -1;
dx['^'] = -1; dy['^'] = 0;
dx['v'] = 1; dy['v'] = 0;
// ===== 读选手输出 =====
char arrow[n][m];
for (int i = 0; i < n; i++) {
string line = ouf.readLine();
if ((int)line.size() != m) {
quitf(_wa, "Line %d length must be %d", i + 1, m);
}
for (int j = 0; j < m; j++) {
char c = line[j];
if (!(c == ' ' || c == '^' || c == 'v' || c == '<' ||
c == '>' || c == '-' || c == '|')) {
quitf(_wa, "Invalid char at (%d, %d)", i, j);
}
arrow[i][j] = c;
}
}
// ===== 模拟 =====
long long x = 0;
int cx = 0, cy = 0;
int dirx = 0, diry = 1; // 初始向右
for (int step = 0; step <= 10000; step++) {
// 出界
if (cx < 0 || cx >= n || cy < 0 || cy >= m) {
if (x == 43) quitf(_ok, "Accepted");
else quitf(_wa, "Exited with x = %lld (not 43)", x);
}
// ===== 执行运算 =====
string s = op[cx][cy];
if (!s.empty()) {
char sign = s[0];
int val = stoi(s.substr(1));
if (sign == '+') x += val;
else if (sign == '-') x -= val;
else if (sign == '*') x *= val;
else if (sign == '/') {
if (val == 0) quitf(_wa, "Divide by zero");
if (x % val) quitf(_wa, "Bi Xu Shi Zheng Shu!");
x /= val;
}
}
// 范围检查
if (x < 0 || x > 1000000000LL) {
quitf(_wa, "x out of range: %lld", x);
}
// ===== 处理箭头 =====
char c = arrow[cx][cy];
if (c == '^' || c == 'v' || c == '<' || c == '>') {
dirx = dx[c];
diry = dy[c];
} else if (c == '-') {
if (x % 2) { dirx = 0; diry = -1; }
else { dirx = 0; diry = 1; }
} else if (c == '|') {
if (x % 2) { dirx = -1; diry = 0; }
else { dirx = 1; diry = 0; }
}
// 移动
cx += dirx;
cy += diry;
}
quitf(_wa, "Did not exit within 10000 steps");
}
AI 写的。
凭运气得分
idea & checker:chengyifan91。
简述题意
每个测试点都会有 的概率 AC,共有 个测试点。
题解
这破题你还要啥题解。
checker
#include<bits/stdc++.h> #include”testlib.h” using namespace std;
int main(int argc, char* argv[]) { registerTestlibCmd(argc, argv); while (!ouf.eof()) ouf.readChar(); mt19937 rnd(random_device{}()), rnd2(time(0)); if ((rnd() % 100 < 50) ^ (rnd2() % 100 < 50)) { quitf(_ok, “Accepted!”); } else { quitf(_wa, “Wrong Answer!”); } return 0; }
3/27 打卡题
idea & solution:chengyifan91。
简述题意
这他妈还要我简述?
题解
方法一:在 3 月 27 日提交 hello world!。
方法二;乘坐时光机,穿越回 3 月 27 日,然后使用方法一。
Cutecatf’s Maze
idea & checker:chengyifan91。
简述题意
你需要在一个三维迷宫中找到 个魔杖。
题解
没有题解,出题人只写了 checker,没有 std,惊不惊喜。
checker
真的是 checker
#include<bits/stdc++.h>
#include"testlib.h"
using namespace std;
int x = 1, y = 6, z = 3, r = 3, get_count = 0, move_count = 0;
const int N = 20;
int mp[N][N][N], magic[N][N][N], get_magic[N];
void init_map() {
mp[1][6][3] = 1;
mp[2][6][3] = 1;
mp[3][6][3] = 1;
magic[3][6][3] = 1;
mp[3][7][3] = 1;
mp[3][7][2] = 1;
mp[4][7][2] = 1;
mp[5][7][2] = 1;
mp[5][7][1] = 1;
mp[6][7][1] = 1;
mp[7][7][1] = 1;
mp[8][7][1] = 1;
mp[9][7][1] = 1;
mp[10][7][1] = 1;
magic[10][7][1] = 2;
mp[10][8][1] = 1;
mp[10][9][1] = 1;
mp[9][9][1] = 1;
mp[8][9][1] = 1;
mp[7][9][1] = 1;
mp[6][9][1] = 1;
mp[5][9][1] = 1;
mp[4][9][1] = 1;
mp[3][9][1] = 1;
mp[2][9][1] = 1;
mp[2][9][2] = 1;
mp[2][9][3] = 1;
mp[3][9][3] = 1;
mp[4][9][3] = 1;
mp[5][9][3] = 1;
mp[6][9][3] = 1;
mp[7][9][3] = 1;
mp[8][9][3] = 1;
mp[9][9][3] = 1;
mp[9][9][4] = 1;
mp[9][9][5] = 1;
mp[9][9][6] = 1;
mp[9][9][7] = 1;
mp[8][9][7] = 1;
mp[7][9][7] = 1;
mp[7][9][6] = 1;
mp[7][9][5] = 1;
mp[6][9][5] = 1;
mp[5][9][5] = 1;
mp[4][9][5] = 1;
mp[4][9][6] = 1;
mp[4][9][7] = 1;
mp[4][9][8] = 1;
magic[4][9][8] = 3;
mp[3][9][8] = 1;
mp[3][8][8] = 1;
mp[2][8][8] = 1;
mp[2][7][8] = 1;
mp[2][6][8] = 1;
mp[3][6][8] = 1;
mp[3][6][7] = 1;
mp[3][6][6] = 1;
mp[3][5][6] = 1;
mp[3][4][6] = 1;
mp[3][3][6] = 1;
magic[3][3][6] = 4;
mp[3][3][7] = 1;
mp[4][3][7] = 1;
mp[5][3][7] = 1;
mp[5][4][7] = 1;
mp[5][4][6] = 1;
mp[5][4][5] = 1;
mp[5][5][5] = 1;
mp[5][6][5] = 1;
mp[5][7][5] = 1;
mp[5][7][6] = 1;
mp[5][7][7] = 1;
mp[6][7][7] = 1;
mp[7][7][7] = 1;
mp[7][7][8] = 1;
mp[7][7][9] = 1;
mp[6][7][9] = 1;
mp[5][7][9] = 1;
magic[5][7][9] = 5;
mp[7][6][7] = 1;
mp[7][5][7] = 1;
mp[6][5][7] = 1;
mp[6][5][8] = 1;
mp[6][5][9] = 1;
mp[7][5][9] = 1;
mp[7][4][9] = 1;
mp[7][3][9] = 1;
mp[7][3][8] = 1;
mp[7][3][7] = 1;
mp[8][3][7] = 1;
mp[8][2][7] = 1;
magic[8][2][7] = 6;
mp[8][2][6] = 1;
mp[7][2][6] = 1;
mp[7][2][5] = 1;
mp[7][2][4] = 1;
mp[6][2][4] = 1;
mp[5][2][4] = 1;
mp[5][2][3] = 1;
mp[5][2][2] = 1;
mp[5][3][2] = 1;
mp[5][4][2] = 1;
mp[5][4][3] = 1;
mp[5][5][3] = 1;
mp[5][6][3] = 1;
mp[6][6][3] = 1;
mp[7][6][3] = 1;
mp[7][6][4] = 1;
magic[7][6][4] = 7;
mp[7][6][5] = 1;
mp[8][6][5] = 1;
mp[9][6][5] = 1;
mp[9][6][6] = 1;
mp[9][6][7] = 1;
mp[9][6][8] = 1;
mp[9][5][8] = 1;
mp[9][4][8] = 1;
mp[9][4][7] = 1;
mp[9][4][6] = 1;
mp[9][4][5] = 1;
magic[9][4][5] = 8;
mp[9][3][8] = 1;
mp[9][2][8] = 1;
mp[9][1][8] = 1;
mp[8][1][8] = 1;
mp[7][1][8] = 1;
mp[6][1][8] = 1;
mp[5][1][8] = 1;
mp[4][1][8] = 1;
mp[3][1][8] = 1;
mp[3][1][7] = 1;
mp[3][1][6] = 1;
mp[3][1][5] = 1;
mp[3][1][4] = 1;
mp[3][1][3] = 1;
mp[3][1][2] = 1;
mp[4][1][2] = 1;
magic[4][1][2] = 9;
mp[4][1][1] = 1;
mp[5][1][1] = 1;
mp[6][1][1] = 1;
mp[7][1][1] = 1;
mp[8][1][1] = 1;
mp[8][2][1] = 1;
mp[8][3][1] = 1;
mp[8][4][1] = 1;
mp[8][4][2] = 1;
mp[8][4][3] = 1;
mp[9][4][3] = 1;
mp[10][4][3] = 1;
magic[10][4][3] = 10;
}
void move(int dx, int dy, int dz) {
++move_count;
if (move_count > 300) quitf(_wa, "");
int nx = x + dx, ny = y + dy, nz = z + dz;
if (nx < 1 || ny < 1 || nz < 1 || nx > 10 || ny > 10 || nz > 10) return ;
if (!mp[nx][ny][nz]) return ;
x = nx, y = ny, z = nz;
if (magic[x][y][z]) {
get_magic[magic[x][y][z]] = 1, magic[x][y][z] = 0;
++get_count;
if (get_count % 5 == 0) r += 2;
}
}
int main(int argc, char* argv[]) {
registerTestlibCmd(argc, argv);
init_map();
string s;
while (!ouf.eof()) s += ouf.readLine() + "\n";
int t = ans.readInt();
for (char c : s) {
if (c == 'w') move(0, -1, 0);
if (c == 's') move(0, 1, 0);
if (c == 'a') move(0, 0, -1);
if (c == 'd') move(0, 0, 1);
if (c == 'f') move(1, 0, 0);
if (c == 'b') move(-1, 0, 0);
}
if (t <= 49) {
int tx = (t+6)/7, ty = t-(tx-1)*7;
if (max(abs(tx-4), abs(ty-4)) > r/2) quitp(0.25, "");
if (tx == 4 && ty == 4) quitp(0.1, "");
tx += y-4, ty += z-4;
if (tx < 1 || ty < 1 || tx > 10 || ty > 10) quitp(0.5+x/20.0, "");
if (magic[x][tx][ty]) quitp(0.15, "");
if (mp[x][tx][ty]) quitp(0.05, "");
quitp(0.5+x/20.0, "");
} else {
t -= 49;
if (get_magic[t]) quitf(_ok, "");
else quitf(_wa, "");
}
return 0;
}自定义计分脚本
@sum = 0;
@final_time = 114;
@final_memory = 526334;
@time1 = 0;
@memory1 = 0;
if @score1 == 0; then
@status1 = WA;
fi
if @score1 == 1; then
@status1 = WA;
fi
if @score1 == 2; then
@status1 = AC;
fi
if @score1 == 3; then
@status1 = TLE;
fi
if @score1 > 10; then
@status1 = MLE;
@time1 = @score1 - 10;
fi
if @score1 == 5; then
@status1 = MLE;
@time1 = 999;
fi
@score1 = 0;
@time2 = 0;
@memory2 = 0;
if @score2 == 0; then
@status2 = WA;
fi
if @score2 == 1; then
@status2 = WA;
fi
if @score2 == 2; then
@status2 = AC;
fi
if @score2 == 3; then
@status2 = TLE;
fi
if @score2 > 10; then
@status2 = MLE;
@time2 = @score2 - 10;
fi
if @score2 == 5; then
@status2 = MLE;
@time2 = 999;
fi
@score2 = 0;
@time3 = 0;
@memory3 = 0;
if @score3 == 0; then
@status3 = WA;
fi
if @score3 == 1; then
@status3 = WA;
fi
if @score3 == 2; then
@status3 = AC;
fi
if @score3 == 3; then
@status3 = TLE;
fi
if @score3 > 10; then
@status3 = MLE;
@time3 = @score3 - 10;
fi
if @score3 == 5; then
@status3 = MLE;
@time3 = 999;
fi
@score3 = 0;
@time4 = 0;
@memory4 = 0;
if @score4 == 0; then
@status4 = WA;
fi
if @score4 == 1; then
@status4 = WA;
fi
if @score4 == 2; then
@status4 = AC;
fi
if @score4 == 3; then
@status4 = TLE;
fi
if @score4 > 10; then
@status4 = MLE;
@time4 = @score4 - 10;
fi
if @score4 == 5; then
@status4 = MLE;
@time4 = 999;
fi
@score4 = 0;
@time5 = 0;
@memory5 = 0;
if @score5 == 0; then
@status5 = WA;
fi
if @score5 == 1; then
@status5 = WA;
fi
if @score5 == 2; then
@status5 = AC;
fi
if @score5 == 3; then
@status5 = TLE;
fi
if @score5 > 10; then
@status5 = MLE;
@time5 = @score5 - 10;
fi
if @score5 == 5; then
@status5 = MLE;
@time5 = 999;
fi
@score5 = 0;
@time6 = 0;
@memory6 = 0;
if @score6 == 0; then
@status6 = WA;
fi
if @score6 == 1; then
@status6 = WA;
fi
if @score6 == 2; then
@status6 = AC;
fi
if @score6 == 3; then
@status6 = TLE;
fi
if @score6 > 10; then
@status6 = MLE;
@time6 = @score6 - 10;
fi
if @score6 == 5; then
@status6 = MLE;
@time6 = 999;
fi
@score6 = 0;
@time7 = 0;
@memory7 = 0;
if @score7 == 0; then
@status7 = WA;
fi
if @score7 == 1; then
@status7 = WA;
fi
if @score7 == 2; then
@status7 = AC;
fi
if @score7 == 3; then
@status7 = TLE;
fi
if @score7 > 10; then
@status7 = MLE;
@time7 = @score7 - 10;
fi
if @score7 == 5; then
@status7 = MLE;
@time7 = 999;
fi
@score7 = 0;
@time8 = 0;
@memory8 = 0;
if @score8 == 0; then
@status8 = WA;
fi
if @score8 == 1; then
@status8 = WA;
fi
if @score8 == 2; then
@status8 = AC;
fi
if @score8 == 3; then
@status8 = TLE;
fi
if @score8 > 10; then
@status8 = MLE;
@time8 = @score8 - 10;
fi
if @score8 == 5; then
@status8 = MLE;
@time8 = 999;
fi
@score8 = 0;
@time9 = 0;
@memory9 = 0;
if @score9 == 0; then
@status9 = WA;
fi
if @score9 == 1; then
@status9 = WA;
fi
if @score9 == 2; then
@status9 = AC;
fi
if @score9 == 3; then
@status9 = TLE;
fi
if @score9 > 10; then
@status9 = MLE;
@time9 = @score9 - 10;
fi
if @score9 == 5; then
@status9 = MLE;
@time9 = 999;
fi
@score9 = 0;
@time10 = 0;
@memory10 = 0;
if @score10 == 0; then
@status10 = WA;
fi
if @score10 == 1; then
@status10 = WA;
fi
if @score10 == 2; then
@status10 = AC;
fi
if @score10 == 3; then
@status10 = TLE;
fi
if @score10 > 10; then
@status10 = MLE;
@time10 = @score10 - 10;
fi
if @score10 == 5; then
@status10 = MLE;
@time10 = 999;
fi
@score10 = 0;
@time11 = 0;
@memory11 = 0;
if @score11 == 0; then
@status11 = WA;
fi
if @score11 == 1; then
@status11 = WA;
fi
if @score11 == 2; then
@status11 = AC;
fi
if @score11 == 3; then
@status11 = TLE;
fi
if @score11 > 10; then
@status11 = MLE;
@time11 = @score11 - 10;
fi
if @score11 == 5; then
@status11 = MLE;
@time11 = 999;
fi
@score11 = 0;
@time12 = 0;
@memory12 = 0;
if @score12 == 0; then
@status12 = WA;
fi
if @score12 == 1; then
@status12 = WA;
fi
if @score12 == 2; then
@status12 = AC;
fi
if @score12 == 3; then
@status12 = TLE;
fi
if @score12 > 10; then
@status12 = MLE;
@time12 = @score12 - 10;
fi
if @score12 == 5; then
@status12 = MLE;
@time12 = 999;
fi
@score12 = 0;
@time13 = 0;
@memory13 = 0;
if @score13 == 0; then
@status13 = WA;
fi
if @score13 == 1; then
@status13 = WA;
fi
if @score13 == 2; then
@status13 = AC;
fi
if @score13 == 3; then
@status13 = TLE;
fi
if @score13 > 10; then
@status13 = MLE;
@time13 = @score13 - 10;
fi
if @score13 == 5; then
@status13 = MLE;
@time13 = 999;
fi
@score13 = 0;
@time14 = 0;
@memory14 = 0;
if @score14 == 0; then
@status14 = WA;
fi
if @score14 == 1; then
@status14 = WA;
fi
if @score14 == 2; then
@status14 = AC;
fi
if @score14 == 3; then
@status14 = TLE;
fi
if @score14 > 10; then
@status14 = MLE;
@time14 = @score14 - 10;
fi
if @score14 == 5; then
@status14 = MLE;
@time14 = 999;
fi
@score14 = 0;
@time15 = 0;
@memory15 = 0;
if @score15 == 0; then
@status15 = WA;
fi
if @score15 == 1; then
@status15 = WA;
fi
if @score15 == 2; then
@status15 = AC;
fi
if @score15 == 3; then
@status15 = TLE;
fi
if @score15 > 10; then
@status15 = MLE;
@time15 = @score15 - 10;
fi
if @score15 == 5; then
@status15 = MLE;
@time15 = 999;
fi
@score15 = 0;
@time16 = 0;
@memory16 = 0;
if @score16 == 0; then
@status16 = WA;
fi
if @score16 == 1; then
@status16 = WA;
fi
if @score16 == 2; then
@status16 = AC;
fi
if @score16 == 3; then
@status16 = TLE;
fi
if @score16 > 10; then
@status16 = MLE;
@time16 = @score16 - 10;
fi
if @score16 == 5; then
@status16 = MLE;
@time16 = 999;
fi
@score16 = 0;
@time17 = 0;
@memory17 = 0;
if @score17 == 0; then
@status17 = WA;
fi
if @score17 == 1; then
@status17 = WA;
fi
if @score17 == 2; then
@status17 = AC;
fi
if @score17 == 3; then
@status17 = TLE;
fi
if @score17 > 10; then
@status17 = MLE;
@time17 = @score17 - 10;
fi
if @score17 == 5; then
@status17 = MLE;
@time17 = 999;
fi
@score17 = 0;
@time18 = 0;
@memory18 = 0;
if @score18 == 0; then
@status18 = WA;
fi
if @score18 == 1; then
@status18 = WA;
fi
if @score18 == 2; then
@status18 = AC;
fi
if @score18 == 3; then
@status18 = TLE;
fi
if @score18 > 10; then
@status18 = MLE;
@time18 = @score18 - 10;
fi
if @score18 == 5; then
@status18 = MLE;
@time18 = 999;
fi
@score18 = 0;
@time19 = 0;
@memory19 = 0;
if @score19 == 0; then
@status19 = WA;
fi
if @score19 == 1; then
@status19 = WA;
fi
if @score19 == 2; then
@status19 = AC;
fi
if @score19 == 3; then
@status19 = TLE;
fi
if @score19 > 10; then
@status19 = MLE;
@time19 = @score19 - 10;
fi
if @score19 == 5; then
@status19 = MLE;
@time19 = 999;
fi
@score19 = 0;
@time20 = 0;
@memory20 = 0;
if @score20 == 0; then
@status20 = WA;
fi
if @score20 == 1; then
@status20 = WA;
fi
if @score20 == 2; then
@status20 = AC;
fi
if @score20 == 3; then
@status20 = TLE;
fi
if @score20 > 10; then
@status20 = MLE;
@time20 = @score20 - 10;
fi
if @score20 == 5; then
@status20 = MLE;
@time20 = 999;
fi
@score20 = 0;
@time21 = 0;
@memory21 = 0;
if @score21 == 0; then
@status21 = WA;
fi
if @score21 == 1; then
@status21 = WA;
fi
if @score21 == 2; then
@status21 = AC;
fi
if @score21 == 3; then
@status21 = TLE;
fi
if @score21 > 10; then
@status21 = MLE;
@time21 = @score21 - 10;
fi
if @score21 == 5; then
@status21 = MLE;
@time21 = 999;
fi
@score21 = 0;
@time22 = 0;
@memory22 = 0;
if @score22 == 0; then
@status22 = WA;
fi
if @score22 == 1; then
@status22 = WA;
fi
if @score22 == 2; then
@status22 = AC;
fi
if @score22 == 3; then
@status22 = TLE;
fi
if @score22 > 10; then
@status22 = MLE;
@time22 = @score22 - 10;
fi
if @score22 == 5; then
@status22 = MLE;
@time22 = 999;
fi
@score22 = 0;
@time23 = 0;
@memory23 = 0;
if @score23 == 0; then
@status23 = WA;
fi
if @score23 == 1; then
@status23 = WA;
fi
if @score23 == 2; then
@status23 = AC;
fi
if @score23 == 3; then
@status23 = TLE;
fi
if @score23 > 10; then
@status23 = MLE;
@time23 = @score23 - 10;
fi
if @score23 == 5; then
@status23 = MLE;
@time23 = 999;
fi
@score23 = 0;
@time24 = 0;
@memory24 = 0;
if @score24 == 0; then
@status24 = WA;
fi
if @score24 == 1; then
@status24 = WA;
fi
if @score24 == 2; then
@status24 = AC;
fi
if @score24 == 3; then
@status24 = TLE;
fi
if @score24 > 10; then
@status24 = MLE;
@time24 = @score24 - 10;
fi
if @score24 == 5; then
@status24 = MLE;
@time24 = 999;
fi
@score24 = 0;
@time25 = 0;
@memory25 = 0;
if @score25 == 0; then
@status25 = WA;
fi
if @score25 == 1; then
@status25 = WA;
fi
if @score25 == 2; then
@status25 = AC;
fi
if @score25 == 3; then
@status25 = TLE;
fi
if @score25 > 10; then
@status25 = MLE;
@time25 = @score25 - 10;
fi
if @score25 == 5; then
@status25 = MLE;
@time25 = 999;
fi
@score25 = 0;
@time26 = 0;
@memory26 = 0;
if @score26 == 0; then
@status26 = WA;
fi
if @score26 == 1; then
@status26 = WA;
fi
if @score26 == 2; then
@status26 = AC;
fi
if @score26 == 3; then
@status26 = TLE;
fi
if @score26 > 10; then
@status26 = MLE;
@time26 = @score26 - 10;
fi
if @score26 == 5; then
@status26 = MLE;
@time26 = 999;
fi
@score26 = 0;
@time27 = 0;
@memory27 = 0;
if @score27 == 0; then
@status27 = WA;
fi
if @score27 == 1; then
@status27 = WA;
fi
if @score27 == 2; then
@status27 = AC;
fi
if @score27 == 3; then
@status27 = TLE;
fi
if @score27 > 10; then
@status27 = MLE;
@time27 = @score27 - 10;
fi
if @score27 == 5; then
@status27 = MLE;
@time27 = 999;
fi
@score27 = 0;
@time28 = 0;
@memory28 = 0;
if @score28 == 0; then
@status28 = WA;
fi
if @score28 == 1; then
@status28 = WA;
fi
if @score28 == 2; then
@status28 = AC;
fi
if @score28 == 3; then
@status28 = TLE;
fi
if @score28 > 10; then
@status28 = MLE;
@time28 = @score28 - 10;
fi
if @score28 == 5; then
@status28 = MLE;
@time28 = 999;
fi
@score28 = 0;
@time29 = 0;
@memory29 = 0;
if @score29 == 0; then
@status29 = WA;
fi
if @score29 == 1; then
@status29 = WA;
fi
if @score29 == 2; then
@status29 = AC;
fi
if @score29 == 3; then
@status29 = TLE;
fi
if @score29 > 10; then
@status29 = MLE;
@time29 = @score29 - 10;
fi
if @score29 == 5; then
@status29 = MLE;
@time29 = 999;
fi
@score29 = 0;
@time30 = 0;
@memory30 = 0;
if @score30 == 0; then
@status30 = WA;
fi
if @score30 == 1; then
@status30 = WA;
fi
if @score30 == 2; then
@status30 = AC;
fi
if @score30 == 3; then
@status30 = TLE;
fi
if @score30 > 10; then
@status30 = MLE;
@time30 = @score30 - 10;
fi
if @score30 == 5; then
@status30 = MLE;
@time30 = 999;
fi
@score30 = 0;
@time31 = 0;
@memory31 = 0;
if @score31 == 0; then
@status31 = WA;
fi
if @score31 == 1; then
@status31 = WA;
fi
if @score31 == 2; then
@status31 = AC;
fi
if @score31 == 3; then
@status31 = TLE;
fi
if @score31 > 10; then
@status31 = MLE;
@time31 = @score31 - 10;
fi
if @score31 == 5; then
@status31 = MLE;
@time31 = 999;
fi
@score31 = 0;
@time32 = 0;
@memory32 = 0;
if @score32 == 0; then
@status32 = WA;
fi
if @score32 == 1; then
@status32 = WA;
fi
if @score32 == 2; then
@status32 = AC;
fi
if @score32 == 3; then
@status32 = TLE;
fi
if @score32 > 10; then
@status32 = MLE;
@time32 = @score32 - 10;
fi
if @score32 == 5; then
@status32 = MLE;
@time32 = 999;
fi
@score32 = 0;
@time33 = 0;
@memory33 = 0;
if @score33 == 0; then
@status33 = WA;
fi
if @score33 == 1; then
@status33 = WA;
fi
if @score33 == 2; then
@status33 = AC;
fi
if @score33 == 3; then
@status33 = TLE;
fi
if @score33 > 10; then
@status33 = MLE;
@time33 = @score33 - 10;
fi
if @score33 == 5; then
@status33 = MLE;
@time33 = 999;
fi
@score33 = 0;
@time34 = 0;
@memory34 = 0;
if @score34 == 0; then
@status34 = WA;
fi
if @score34 == 1; then
@status34 = WA;
fi
if @score34 == 2; then
@status34 = AC;
fi
if @score34 == 3; then
@status34 = TLE;
fi
if @score34 > 10; then
@status34 = MLE;
@time34 = @score34 - 10;
fi
if @score34 == 5; then
@status34 = MLE;
@time34 = 999;
fi
@score34 = 0;
@time35 = 0;
@memory35 = 0;
if @score35 == 0; then
@status35 = WA;
fi
if @score35 == 1; then
@status35 = WA;
fi
if @score35 == 2; then
@status35 = AC;
fi
if @score35 == 3; then
@status35 = TLE;
fi
if @score35 > 10; then
@status35 = MLE;
@time35 = @score35 - 10;
fi
if @score35 == 5; then
@status35 = MLE;
@time35 = 999;
fi
@score35 = 0;
@time36 = 0;
@memory36 = 0;
if @score36 == 0; then
@status36 = WA;
fi
if @score36 == 1; then
@status36 = WA;
fi
if @score36 == 2; then
@status36 = AC;
fi
if @score36 == 3; then
@status36 = TLE;
fi
if @score36 > 10; then
@status36 = MLE;
@time36 = @score36 - 10;
fi
if @score36 == 5; then
@status36 = MLE;
@time36 = 999;
fi
@score36 = 0;
@time37 = 0;
@memory37 = 0;
if @score37 == 0; then
@status37 = WA;
fi
if @score37 == 1; then
@status37 = WA;
fi
if @score37 == 2; then
@status37 = AC;
fi
if @score37 == 3; then
@status37 = TLE;
fi
if @score37 > 10; then
@status37 = MLE;
@time37 = @score37 - 10;
fi
if @score37 == 5; then
@status37 = MLE;
@time37 = 999;
fi
@score37 = 0;
@time38 = 0;
@memory38 = 0;
if @score38 == 0; then
@status38 = WA;
fi
if @score38 == 1; then
@status38 = WA;
fi
if @score38 == 2; then
@status38 = AC;
fi
if @score38 == 3; then
@status38 = TLE;
fi
if @score38 > 10; then
@status38 = MLE;
@time38 = @score38 - 10;
fi
if @score38 == 5; then
@status38 = MLE;
@time38 = 999;
fi
@score38 = 0;
@time39 = 0;
@memory39 = 0;
if @score39 == 0; then
@status39 = WA;
fi
if @score39 == 1; then
@status39 = WA;
fi
if @score39 == 2; then
@status39 = AC;
fi
if @score39 == 3; then
@status39 = TLE;
fi
if @score39 > 10; then
@status39 = MLE;
@time39 = @score39 - 10;
fi
if @score39 == 5; then
@status39 = MLE;
@time39 = 999;
fi
@score39 = 0;
@time40 = 0;
@memory40 = 0;
if @score40 == 0; then
@status40 = WA;
fi
if @score40 == 1; then
@status40 = WA;
fi
if @score40 == 2; then
@status40 = AC;
fi
if @score40 == 3; then
@status40 = TLE;
fi
if @score40 > 10; then
@status40 = MLE;
@time40 = @score40 - 10;
fi
if @score40 == 5; then
@status40 = MLE;
@time40 = 999;
fi
@score40 = 0;
@time41 = 0;
@memory41 = 0;
if @score41 == 0; then
@status41 = WA;
fi
if @score41 == 1; then
@status41 = WA;
fi
if @score41 == 2; then
@status41 = AC;
fi
if @score41 == 3; then
@status41 = TLE;
fi
if @score41 > 10; then
@status41 = MLE;
@time41 = @score41 - 10;
fi
if @score41 == 5; then
@status41 = MLE;
@time41 = 999;
fi
@score41 = 0;
@time42 = 0;
@memory42 = 0;
if @score42 == 0; then
@status42 = WA;
fi
if @score42 == 1; then
@status42 = WA;
fi
if @score42 == 2; then
@status42 = AC;
fi
if @score42 == 3; then
@status42 = TLE;
fi
if @score42 > 10; then
@status42 = MLE;
@time42 = @score42 - 10;
fi
if @score42 == 5; then
@status42 = MLE;
@time42 = 999;
fi
@score42 = 0;
@time43 = 0;
@memory43 = 0;
if @score43 == 0; then
@status43 = WA;
fi
if @score43 == 1; then
@status43 = WA;
fi
if @score43 == 2; then
@status43 = AC;
fi
if @score43 == 3; then
@status43 = TLE;
fi
if @score43 > 10; then
@status43 = MLE;
@time43 = @score43 - 10;
fi
if @score43 == 5; then
@status43 = MLE;
@time43 = 999;
fi
@score43 = 0;
@time44 = 0;
@memory44 = 0;
if @score44 == 0; then
@status44 = WA;
fi
if @score44 == 1; then
@status44 = WA;
fi
if @score44 == 2; then
@status44 = AC;
fi
if @score44 == 3; then
@status44 = TLE;
fi
if @score44 > 10; then
@status44 = MLE;
@time44 = @score44 - 10;
fi
if @score44 == 5; then
@status44 = MLE;
@time44 = 999;
fi
@score44 = 0;
@time45 = 0;
@memory45 = 0;
if @score45 == 0; then
@status45 = WA;
fi
if @score45 == 1; then
@status45 = WA;
fi
if @score45 == 2; then
@status45 = AC;
fi
if @score45 == 3; then
@status45 = TLE;
fi
if @score45 > 10; then
@status45 = MLE;
@time45 = @score45 - 10;
fi
if @score45 == 5; then
@status45 = MLE;
@time45 = 999;
fi
@score45 = 0;
@time46 = 0;
@memory46 = 0;
if @score46 == 0; then
@status46 = WA;
fi
if @score46 == 1; then
@status46 = WA;
fi
if @score46 == 2; then
@status46 = AC;
fi
if @score46 == 3; then
@status46 = TLE;
fi
if @score46 > 10; then
@status46 = MLE;
@time46 = @score46 - 10;
fi
if @score46 == 5; then
@status46 = MLE;
@time46 = 999;
fi
@score46 = 0;
@time47 = 0;
@memory47 = 0;
if @score47 == 0; then
@status47 = WA;
fi
if @score47 == 1; then
@status47 = WA;
fi
if @score47 == 2; then
@status47 = AC;
fi
if @score47 == 3; then
@status47 = TLE;
fi
if @score47 > 10; then
@status47 = MLE;
@time47 = @score47 - 10;
fi
if @score47 == 5; then
@status47 = MLE;
@time47 = 999;
fi
@score47 = 0;
@time48 = 0;
@memory48 = 0;
if @score48 == 0; then
@status48 = WA;
fi
if @score48 == 1; then
@status48 = WA;
fi
if @score48 == 2; then
@status48 = AC;
fi
if @score48 == 3; then
@status48 = TLE;
fi
if @score48 > 10; then
@status48 = MLE;
@time48 = @score48 - 10;
fi
if @score48 == 5; then
@status48 = MLE;
@time48 = 999;
fi
@score48 = 0;
@time49 = 0;
@memory49 = 0;
if @score49 == 0; then
@status49 = WA;
fi
if @score49 == 1; then
@status49 = WA;
fi
if @score49 == 2; then
@status49 = AC;
fi
if @score49 == 3; then
@status49 = TLE;
fi
if @score49 > 10; then
@status49 = MLE;
@time49 = @score49 - 10;
fi
if @score49 == 5; then
@status49 = MLE;
@time49 = 999;
fi
@score49 = 0;
@final_status = AC;
@total_score = 0;2027 Academic Ranking
idea & solution:chengyifan91。
这题神了。
简述题意
有 个人,第一个人是 chengyifan91,这些人里面只有 chengyifan91 参加过 YFOI-A2026。
给出他们在洛谷上显示的 YFOI-A2027 的成绩,给他们做一个排名,并且你需要把和 chengyifan91 同分的人的分数设为 。
题解
比赛说明有一个 不要白不要 奖项,你发现现实中的 chengyifan91 拿到了这个奖项,给 chengyifan91 加十分然后排名即可。
打音游?愚人节!
idea:chengyifan91。
谁能想到是个缝合怪曲子。
【愚人节特供】凭实力得分
idea & solution & game:chengyifan91。
简述题意
棍母
题解
每道题的答案:
P6578。chengyifan01。P9754。P3380。chenxingye。12。16.02。P11738。chengyifan。cutecatf。
游戏源码
#include<bits/stdc++.h>
#include<windows.h>
#define _ 0
#define main(x) MiAn();int mIaN();main(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);int t=1;if(strlen(#x))cin>>t;while(t--)mIaN();}int mIaN()
using namespace std;
string send(string s, string end="按下回车继续") {
system("cls");
cout << s << endl;
cout << "[" << end << "]" << endl;
getline(cin, s);
return s;
}
string choice(vector<string> v) {
while (1) {
system("cls");
int t = v.size();
for (string s : v) cout << s << "\n";
cout << "[键入一个大写字母,按下回车]" << endl;
string s;
getline(cin, s);
if (s.size() != 1) continue;
if (s[0] < 'A' || s[0] > 'A'+t-1) continue;
return s.substr(0, 1);
}
}
string xiaoxiezimuA = "A";
string xiaoxiezimuB = "B";
string xiaoxiezimuC = "C";
string xiaoxiezimuD = "D";
string xiaoxiezimuE = "E";
string xiaoxiezimuF = "F";
string xiaoxiezimuG = "G";
string xiaoxiezimuH = "H";
string xiaoxiezimuI = "I";
string xiaoxiezimuJ = "J";
string xiaoxiezimuK = "K";
string xiaoxiezimuL = "L";
string xiaoxiezimuM = "M";
string xiaoxiezimuN = "N";
string xiaoxiezimuO = "O";
string xiaoxiezimuP = "P";
string xiaoxiezimuQ = "Q";
string xiaoxiezimuR = "R";
string xiaoxiezimuS = "S";
string xiaoxiezimuT = "T";
string xiaoxiezimuU = "U";
string xiaoxiezimuV = "V";
string xiaoxiezimuW = "W";
string xiaoxiezimuX = "X";
string xiaoxiezimuY = "Y";
string xiaoxiezimuZ = "Z";
string daxiezimua = "a";
string daxiezimub = "b";
string daxiezimuc = "c";
string daxiezimud = "d";
string daxiezimue = "e";
string daxiezimuf = "f";
string daxiezimug = "g";
string daxiezimuh = "h";
string daxiezimui = "i";
string daxiezimuj = "j";
string daxiezimuk = "k";
string daxiezimul = "l";
string daxiezimum = "m";
string daxiezimun = "n";
string daxiezimuo = "o";
string daxiezimup = "p";
string daxiezimuq = "q";
string daxiezimur = "r";
string daxiezimus = "s";
string daxiezimut = "t";
string daxiezimuu = "u";
string daxiezimuv = "v";
string daxiezimuw = "w";
string daxiezimux = "x";
string daxiezimuy = "y";
string daxiezimuz = "z";
string shuzi0 = "0";
string shuzi1 = "1";
string shuzi2 = "2";
string shuzi3 = "3";
string shuzi4 = "4";
string shuzi5 = "5";
string shuzi6 = "6";
string shuzi7 = "7";
string shuzi8 = "8";
string shuzi9 = "9";
string aite = "@";
string jinghao = "#";
string xinghao = "*";
string meiyuan = "$";
string yigekeaidefuhao = "&";
string wenhao = "!";
string orzorzorz = "%";
string cifang = "^";
string jianfa = "+";
void failed() {
send("[很遗憾,游戏失败了,请再接再厉!]");
send(R"( /\_____/\
/ o o \
( == ^ == )
) (
( )
( ( ) ( ) )
(__(__)___(__)__))");
exit(0);
}
void p1() {
if (send("[====第一关====]\nchengyifan91 最喜欢的题号是什么?", "键入一个洛谷题号,按下回车") != "P6578") failed();
send("恭喜你,通过了第一关!");
send("chengyifan91 好感度 +10");
send("当前好感度:10");
send("每一关结束后,你可以结束游戏,拿到好感度对应的分数,或者继续游戏,获得更多的好感度。");
if (choice({"A. 继续游戏", "B. 结束游戏"}) == "B") {
send("chengyifan91 送给你一串密码喵!"+jinghao+shuzi8+xiaoxiezimuY+daxiezimut+meiyuan+shuzi5+daxiezimuv+xiaoxiezimuB+xinghao+shuzi3+xiaoxiezimuW+daxiezimup+aite+shuzi7+daxiezimuz+xiaoxiezimuL);
send("别忘记把他提交到 L 题中!");
send("[游戏结束]", "按下回车结束游戏");
exit(0);
}
}
void p2() {
if (send("[====第二关====]\nchengyifan91 在刚注册洛谷时叫什么?", "键入一个名称,按下回车") != "chengyifan01") failed();
send("恭喜你,通过了第二关!");
send("chengyifan91 好感度 +10");
send("当前好感度:20");
if (choice({"A. 继续游戏", "B. 结束游戏"}) == "B") {
send("chengyifan91 送给你一串密码喵!"+shuzi9+aite+daxiezimuk+xiaoxiezimuR+yigekeaidefuhao+shuzi2+daxiezimum+xiaoxiezimuX+jinghao+shuzi6+xiaoxiezimuQ+daxiezimup+meiyuan+shuzi4+daxiezimun+xiaoxiezimuW);
send("别忘记把他提交到 L 题中!");
send("[游戏结束]", "按下回车结束游戏");
exit(0);
}
}
void p3() {
if (send("[====第三关====]\nchengyifan91 第一个通过的大模拟的题号是什么?", "键入一个洛谷题号,按下回车") != "P9754") failed();
send("恭喜你,通过了第三关!");
send("chengyifan91 好感度 +10");
send("当前好感度:30");
if (choice({"A. 继续游戏", "B. 结束游戏"}) == "B") {
send("chengyifan91 送给你一串密码喵!"+shuzi7+meiyuan+daxiezimum+xiaoxiezimuR+shuzi9+jinghao+daxiezimuk+xiaoxiezimuL+aite+daxiezimup+xiaoxiezimuX+shuzi2+yigekeaidefuhao+daxiezimun+xiaoxiezimuQ+shuzi4);
send("别忘记把他提交到 L 题中!");
send("[游戏结束]", "按下回车结束游戏");
exit(0);
}
}
void p4() {
if (send("[====第四关====]\nchengyifan91 第 100 个通过的紫题的题号是什么?", "键入一个洛谷题号,按下回车") != "P3380") failed();
send("恭喜你,通过了第四关!");
send("chengyifan91 好感度 +10");
send("当前好感度:40");
if (choice({"A. 继续游戏", "B. 结束游戏"}) == "B") {
send("chengyifan91 送给你一串密码喵!"+jinghao+shuzi8+xiaoxiezimuF+daxiezimum+meiyuan+shuzi3+xiaoxiezimuV+daxiezimuk+aite+shuzi9+xiaoxiezimuL+daxiezimup+yigekeaidefuhao+shuzi2+xiaoxiezimuX+daxiezimun);
send("别忘记把他提交到 L 题中!");
send("[游戏结束]", "按下回车结束游戏");
exit(0);
}
}
void p5() {
if (send("[====第五关====]\n任意说出一个 chengyifan91 的小学 whk 同学的名字。", "键入一个人名(全拼,比如 chengyifan)") != "chenxingye") failed();
send("恭喜你,通过了第五关!");
send("chengyifan91 好感度 +10");
send("当前好感度:50");
if (choice({"A. 继续游戏", "B. 结束游戏"}) == "B") {
send("chengyifan91 送给你一串密码喵!"+meiyuan+shuzi5+xiaoxiezimuH+daxiezimut+xinghao+shuzi7+xiaoxiezimuY+daxiezimub+wenhao+shuzi4+xiaoxiezimuW+daxiezimus+jinghao+shuzi9+xiaoxiezimuR+daxiezimuz);
send("别忘记把他提交到 L 题中!");
send("[游戏结束]", "按下回车结束游戏");
exit(0);
}
}
void p6() {
if (send("[====第六关====]\nchengyifan91 今年几岁了?", "键入一个正整数") != "12") failed();
send("恭喜你,通过了第六关!");
send("chengyifan91 好感度 +10");
send("当前好感度:60");
if (choice({"A. 继续游戏", "B. 结束游戏"}) == "B") {
send("chengyifan91 送给你一串密码喵!"+aite+shuzi2+xiaoxiezimuQ+daxiezimuw+orzorzorz+shuzi6+xiaoxiezimuJ+daxiezimuc+cifang+shuzi1+xiaoxiezimuU+daxiezimuv+yigekeaidefuhao+shuzi8+xiaoxiezimuM+daxiezimue);
send("别忘记把他提交到 L 题中!");
send("[游戏结束]", "按下回车结束游戏");
exit(0);
}
}
void p7() {
if (send("[====第七关====]\n2026 年 3 月 31 日 16 点 4 分,chengyifan91 的 rks 是多少?", "键入一个浮点数,保留 2 位小数") != "16.02") failed();
send("恭喜你,通过了第七关!");
send("chengyifan91 好感度 +10");
send("当前好感度:70");
if (choice({"A. 继续游戏", "B. 结束游戏"}) == "B") {
send("chengyifan91 送给你一串密码喵!"+yigekeaidefuhao+shuzi9+xiaoxiezimuX+daxiezimuz+jinghao+shuzi4+xiaoxiezimuR+daxiezimuf+meiyuan+shuzi7+xiaoxiezimuN+daxiezimup+xinghao+shuzi3+xiaoxiezimuL+daxiezimuk);
send("别忘记把他提交到 L 题中!");
send("[游戏结束]", "按下回车结束游戏");
exit(0);
}
}
void p8() {
if (send("[====第八关====]\nchengyifan91 做过码量最大的题是什么", "键入一个洛谷题号") != "P11738") failed();
send("恭喜你,通过了第八关!");
send("chengyifan91 好感度 +10");
send("当前好感度:80");
if (choice({"A. 继续游戏", "B. 结束游戏"}) == "B") {
send("chengyifan91 送给你一串密码喵!"+orzorzorz+shuzi7+xiaoxiezimuJ+daxiezimum+jinghao+shuzi2+xiaoxiezimuR+daxiezimuf+aite+shuzi8+xiaoxiezimuL+daxiezimup+meiyuan+shuzi4+xiaoxiezimuN+daxiezimuq);
send("别忘记把他提交到 L 题中!");
send("[游戏结束]", "按下回车结束游戏");
exit(0);
}
}
void p9() {
if (send("[====第九关====]\nchengyifan91 最喜欢机房里的哪个人?", "键入一个人名(同第五关,全拼)") != "chengyifan") failed();
send("恭喜你,通过了第九关!");
send("chengyifan91 好感度 +10");
send("当前好感度:90");
if (choice({"A. 继续游戏", "B. 结束游戏"}) == "B") {
send("chengyifan91 送给你一串密码喵!"+xinghao+shuzi8+xiaoxiezimuK+daxiezimuj+yigekeaidefuhao+shuzi5+xiaoxiezimuH+daxiezimun+meiyuan+shuzi2+xiaoxiezimuM+daxiezimup+jinghao+shuzi0+xiaoxiezimuZ+daxiezimus);
send("别忘记把他提交到 L 题中!");
send("[游戏结束]", "按下回车结束游戏");
exit(0);
}
}
void p10() {
if (send("[====第十关====]\nchengyifan91 的小名是什么?", "键入一个名称") != "cutecatf") failed();
send("恭喜你,通过了第十关!");
send("chengyifan91 好感度 +10");
send("当前好感度:100");
send("游戏正式结束!");
send("chengyifan91 送给你一串密码喵!"+jianfa+shuzi6+xiaoxiezimuH+daxiezimug+jinghao+shuzi4+xiaoxiezimuR+daxiezimut+yigekeaidefuhao+shuzi8+xiaoxiezimuV+daxiezimub+xinghao+shuzi2+xiaoxiezimuX+daxiezimuz);
send("别忘记把他提交到 L 题中!");
send("[???]");
send("[游戏结束]");
send("[???]");
send("chengyifan91 希望你能认真看完下面的话!");
send("能走到这里,相信你非常了解 chengyifan91 了!");
send("那么接下来,chengyifan91 想请你回答最后一个问题!");
send("[====第十关====]\n你喜欢 chengyifan91 吗?", "???");
send("哈哈哈,这还是第十关!");
send("不管你喜不喜欢我,小 F 都祝你愚人节快乐!", "???");
send("这回真的要说再见了!", "???");
send("拜拜~", "按下回车和小 F 说再见");
exit(0);
}
int main() {
SetConsoleOutputCP(936);
send("欢迎来到【凭实力得分】!");
send("你需要通过一个个关卡,然后在对应的题目输出关卡密码,就能获得分数!");
send("(该游戏考察你对 chengyifan91 的了解程度,而非你的实力。)");
send("注意:若非特殊标明,不要带有空格等额外字符。");
send("接下来,开始闯关吧!");
p1();
p2();
p3();
p4();
p5();
p6();
p7();
p8();
p9();
p10();
return ~~(0^_^0);
}【愚人节特供】0.0
idea & solution:chengyifan91,Cybher。
checker:chengyifan91。
题意简述
自己去看题。
题解
按照题目说的就能拿到满分(但是会棕名)。
checker
真的是 checker
#include<bits/stdc++.h>
#include"testlib.h"
using namespace std;
bool check(string s, string w) {
int t = w.size();
for (int i = 0; i <= s.size()-t; i++) if (s.substr(i, t) == w) return 1;
return 0;
}
int main(int argc, char* argv[]) {
registerTestlibCmd(argc, argv);
string s;
while (!ouf.eof()) s += ouf.readLine();
mt19937 rnd(random_device{}());
if (check(s, "dick") || check(s, "Dick")) {
int t = rnd();
if (t % 5 == 0) {
quitp(0.4, "");
}
if (t % 5 == 1) {
quitp(0.1, "");
}
if (t % 5 == 2) {
quitp(0.2, "");
}
if (t % 5 == 3) {
quitp(0.3, "");
}
if (t % 5 == 4) {
quitp(0.5, "");
}
} else if ((int)s.size() <= 100) {
quitf(_wa, "");
} else if (check(s, "brown") || check(s, "cheater") || check(s, "cheat") || check(s, "Brown") || check(s, "Cheater") || check(s, "Cheat")) {
quitf(_ok, "");
} else {
quitf(_wa, "");
}
return 0;
}自定义计分脚本
@final_time = 0;
@final_memory = 0;
@total_score = 0;
@final_status = AC;
if @score1 == 1; then
@status1 = MLE;
@score1 = 0;
@final_status = UNAC;
fi
if @score1 == 2; then
@status1 = TLE;
@score1 = 0;
@final_status = UNAC;
fi
if @score1 == 3; then
@status1 = WA;
@score1 = 0;
@final_status = UNAC;
fi
if @score1 == 4; then
@status1 = 114514;
@score1 = 0;
@final_status = UNAC;
fi
if @score1 == 5; then
@status1 = AC;
@score1 = 0;
@final_status = UNAC;
fi
@total_score = @total_score + @score1;
@final_time = @final_time + @time1;
if @memory1 > @final_memory; then
@final_memory = @memory1;
fi
if @score2 == 1; then
@status2 = MLE;
@score2 = 0;
@final_status = UNAC;
fi
if @score2 == 2; then
@status2 = TLE;
@score2 = 0;
@final_status = UNAC;
fi
if @score2 == 3; then
@status2 = WA;
@score2 = 0;
@final_status = UNAC;
fi
if @score2 == 4; then
@status2 = 114514;
@score2 = 0;
@final_status = UNAC;
fi
if @score2 == 5; then
@status2 = AC;
@score2 = 0;
@final_status = UNAC;
fi
@total_score = @total_score + @score2;
@final_time = @final_time + @time2;
if @memory2 > @final_memory; then
@final_memory = @memory2;
fi
if @score3 == 1; then
@status3 = MLE;
@score3 = 0;
@final_status = UNAC;
fi
if @score3 == 2; then
@status3 = TLE;
@score3 = 0;
@final_status = UNAC;
fi
if @score3 == 3; then
@status3 = WA;
@score3 = 0;
@final_status = UNAC;
fi
if @score3 == 4; then
@status3 = 114514;
@score3 = 0;
@final_status = UNAC;
fi
if @score3 == 5; then
@status3 = AC;
@score3 = 0;
@final_status = UNAC;
fi
@total_score = @total_score + @score3;
@final_time = @final_time + @time3;
if @memory3 > @final_memory; then
@final_memory = @memory3;
fi
if @score4 == 1; then
@status4 = MLE;
@score4 = 0;
@final_status = UNAC;
fi
if @score4 == 2; then
@status4 = TLE;
@score4 = 0;
@final_status = UNAC;
fi
if @score4 == 3; then
@status4 = WA;
@score4 = 0;
@final_status = UNAC;
fi
if @score4 == 4; then
@status4 = 114514;
@score4 = 0;
@final_status = UNAC;
fi
if @score4 == 5; then
@status4 = AC;
@score4 = 0;
@final_status = UNAC;
fi
@total_score = @total_score + @score4;
@final_time = @final_time + @time4;
if @memory4 > @final_memory; then
@final_memory = @memory4;
fi
if @score5 == 1; then
@status5 = MLE;
@score5 = 0;
@final_status = UNAC;
fi
if @score5 == 2; then
@status5 = TLE;
@score5 = 0;
@final_status = UNAC;
fi
if @score5 == 3; then
@status5 = WA;
@score5 = 0;
@final_status = UNAC;
fi
if @score5 == 4; then
@status5 = 114514;
@score5 = 0;
@final_status = UNAC;
fi
if @score5 == 5; then
@status5 = AC;
@score5 = 0;
@final_status = UNAC;
fi
@total_score = @total_score + @score5;
@final_time = @final_time + @time5;
if @memory5 > @final_memory; then
@final_memory = @memory5;
fi
if @score6 == 1; then
@status6 = MLE;
@score6 = 0;
@final_status = UNAC;
fi
if @score6 == 2; then
@status6 = TLE;
@score6 = 0;
@final_status = UNAC;
fi
if @score6 == 3; then
@status6 = WA;
@score6 = 0;
@final_status = UNAC;
fi
if @score6 == 4; then
@status6 = 114514;
@score6 = 0;
@final_status = UNAC;
fi
if @score6 == 5; then
@status6 = AC;
@score6 = 0;
@final_status = UNAC;
fi
@total_score = @total_score + @score6;
@final_time = @final_time + @time6;
if @memory6 > @final_memory; then
@final_memory = @memory6;
fi
if @score7 == 1; then
@status7 = MLE;
@score7 = 0;
@final_status = UNAC;
fi
if @score7 == 2; then
@status7 = TLE;
@score7 = 0;
@final_status = UNAC;
fi
if @score7 == 3; then
@status7 = WA;
@score7 = 0;
@final_status = UNAC;
fi
if @score7 == 4; then
@status7 = 114514;
@score7 = 0;
@final_status = UNAC;
fi
if @score7 == 5; then
@status7 = AC;
@score7 = 0;
@final_status = UNAC;
fi
@total_score = @total_score + @score7;
@final_time = @final_time + @time7;
if @memory7 > @final_memory; then
@final_memory = @memory7;
fi
if @score8 == 1; then
@status8 = MLE;
@score8 = 0;
@final_status = UNAC;
fi
if @score8 == 2; then
@status8 = TLE;
@score8 = 0;
@final_status = UNAC;
fi
if @score8 == 3; then
@status8 = WA;
@score8 = 0;
@final_status = UNAC;
fi
if @score8 == 4; then
@status8 = 114514;
@score8 = 0;
@final_status = UNAC;
fi
if @score8 == 5; then
@status8 = AC;
@score8 = 0;
@final_status = UNAC;
fi
@total_score = @total_score + @score8;
@final_time = @final_time + @time8;
if @memory8 > @final_memory; then
@final_memory = @memory8;
fi
if @score9 == 1; then
@status9 = MLE;
@score9 = 0;
@final_status = UNAC;
fi
if @score9 == 2; then
@status9 = TLE;
@score9 = 0;
@final_status = UNAC;
fi
if @score9 == 3; then
@status9 = WA;
@score9 = 0;
@final_status = UNAC;
fi
if @score9 == 4; then
@status9 = 114514;
@score9 = 0;
@final_status = UNAC;
fi
if @score9 == 5; then
@status9 = AC;
@score9 = 0;
@final_status = UNAC;
fi
@total_score = @total_score + @score9;
@final_time = @final_time + @time9;
if @memory9 > @final_memory; then
@final_memory = @memory9;
fi
if @score10 == 1; then
@status10 = MLE;
@score10 = 0;
@final_status = UNAC;
fi
if @score10 == 2; then
@status10 = TLE;
@score10 = 0;
@final_status = UNAC;
fi
if @score10 == 3; then
@status10 = WA;
@score10 = 0;
@final_status = UNAC;
fi
if @score10 == 4; then
@status10 = 114514;
@score10 = 0;
@final_status = UNAC;
fi
if @score10 == 5; then
@status10 = AC;
@score10 = 0;
@final_status = UNAC;
fi
@total_score = @total_score + @score10;
@final_time = @final_time + @time10;
if @memory10 > @final_memory; then
@final_memory = @memory10;
fi排行榜
赛后公布。
隐藏奖励说明
- 速通 在 小时内通过 Cutecatf’s Maze。
- 0.0 用 AI 提交一遍所有题目。
- 影子 通过【愚人节特供】凭实力得分。
- 倒霉透了 提交一次倒霉透了。该奖励会和题目的 分抵消,也就是说这题不计入总分。
奖励环节
赛后公布。
结语
本场比赛其实有很多疏漏(比如被机惨,下发 checker,SPJ 出锅,到最后排行榜分数混乱),在这里向大家道歉。未来,我们 不保证 会继续努力,办出更好的愚人节比赛!
祝大家愚人节快乐!