DLMY Solution: April Fool's Contest - Extra Part
终极推理
OI Level
这个 Level 完全是送分,这
是原方程组的解,所以题号就是 U612583,接下来更加简单,因为这道题就是纯模拟,完全不需要任何算法,也不可能超时空,所以我们可以放心地得到以下代码: ::::info[翻译官1 The Translator 1]
#include <bits/stdc++.h>
using namespace std;
struct dict { string amd, kst; } d[110];
string s;
int cur;
string find(string x)
{
for (int i = 1; i <= 100; i++)
if (d[i].amd == x)
return d[i].kst;
return "?";
}
int main()
{
cin >> s;
while (true)
{
cin >> s;
if (s == "Sentence:")
break;
cin >> s;
d[++cur].amd = s;
cin >> s;
d[cur].kst = s;
}
cout << "Translation:";
while (true)
{
cin >> s;
if (s[1] == '.') cout << '\n' << s << ' ';
else if (s == "end") exit(0);
else cout << find(s) << ' ';
}
}
::::
得分
FUN Level
定义新运算很难吗?
首先观察到
综上所述,
接下来猜测
综上所述,
综上所述,所有对
然后就有人在这里放弃了,你自己想想这种题你做到这个地步可能无解吗,显然并非,所以肯定是哪里有点小问题,这个时候我们就要注意到第一种最后其实
所以,综上所述,可得到所有符号的含义:
然而这题到现在还没有结束,还要破解许多乱七八糟的密码,我们一个一个看,第一个
第二个
其中第
第三个
第四个
第五个
第六个
综上所述,我们可以把三个式子都化简一下:
注意到这里
终于搞定了。
Extra Part
先把代码粘过来。 ::::info[code]
pre_def: [
def function int read()
begin
def int x = 0, f = 1;
def char ch = getchar();
while !isdigit(ch) do
begin
if ch == '-' do f = -1;
ch = getchar();
end
while isdigit(ch) do
begin
x = (x<<3) + (x<<1) + ch - '0';
ch = getchar();
end
end_with_(x*f);
end
def const int N = 110;
def int m, n, k, ans, tmp[N], f[N][N], g[N], J[N][N];
def bool vis[N], flag[N][N];
def [
new type (node)
begin
int x, y;
end ] a[N], b[N];
def function int pow2(int x)
begin
end_with_(x*x);
end
def function bool found (int x)
begin
repeat (i) from 1 to n do
if flag[i][x] and vis[i] do
begin
vis[i] = 0;
if tmp[i] == -1 or found(tmp[i]) do
begin
tmp[i] = x;
end_with_(true);
end
end
end_with_(false);
end
def function void dfs(int x, int y )
begin
if y + g[x] >= ans do end_func;
if x > m do
begin
ans = y;
end_func;
end
def int tmp2[N];
repeat (i) from x to m do
begin
repeat (j) from 1 to n do
begin
tmp2[j] = tmp[j];
if J[j][x] and f[j][x] >= i do
flag[j][y+1] = 1;
end
fill (vis) with true;
if found(y+1) do dfs(i+1, y+1);
repeat (j) from 1 to n do
begin
tmp[j] = tmp2[j];
if J[j][x] == 1 and f[j][x] >= i do
flag[j][y+1] = 0;
end
end
end
]
start
m = read(); n = read(); k = read();
repeat (i) from 1 to m do b[i].x = read(), b[i].y = read();
repeat (i) from 1 to n do a[i].x = read(), a[i].y = read();
repeat (i) from 1 to m do
repeat (j) from 1 to n do
if pow2(a[j].x-b[i].x)+pow2(a[j].y-b[i].y) <= pow2(k) do J[j][i] = 1;
repeat (i) from 1 to n do
repeat (j) from m to 1 (j dec) do
if J[i][j] do f[i][j] = max(j, f[i][j+1]);
fill (g) with INF;
g[m+1] = 0;
repeat (i) from m to 1 (i dec) do
repeat (j) from 1 to n do
if J[j][i] do g[i] = min(g[i], g[f[j][i]+1] + 1);
ans = n;
fill (tmp) with -1;
dfs(1, 0);
output ans oe_with_newl;
terminate;
end
::::
为什么有人觉得是 Python 啊?这一看就不是好不好,这就是什么语言都不是的一个自创伪代码,考察对高难度代码的理解能力。
问题 1
送分的,一眼就看到一个名为 dfs 的函数,而且【输出格式】里说只包含小写字母,所以就只要输出 dfs 即可。
问题 2
由于可以用 AI,所以很方便翻译,就是这样: ::::info[code (cpp)]
#include <bits/stdc++.h>
using namespace std;
int read()
{
int x = 0, f = 1;
char ch = getchar();
while (!isdigit(ch))
{
if (ch == '-') f = -1;
ch = getchar();
}
while (isdigit(ch))
{
x = (x<<3) + (x<<1) + ch - '0';
ch = getchar();
}
return x*f;
}
const int N = 110;
int m, n, k, ans, tmp[N], f[N][N], g[N], J[N][N];
bool vis[N], flag[N][N];
struct node { int x, y; } a[N], b[N];
int pow2(int x) { return x * x; }
bool found (int x)
{
for (int i = 1; i <= n; i++)
if (flag[i][x] && vis[i])
{
vis[i] = 0;
if (tmp[i] == -1 || found(tmp[i]))
{
tmp[i] = x;
return 1;
}
}
return 0;
}
void dfs(int x, int y )
{
if (y + g[x] >= ans) return;
if (x > m)
{
ans = y;
return;
}
int tmp2[N];
for (int i = x; i <= m; i++)
{
for (int j = 1; j <= n; j++)
{
tmp2[j] = tmp[j];
if (J[j][x] && f[j][x] >= i)
flag[j][y+1] = 1;
}
memset(vis, true, sizeof(vis));
if (found(y+1)) dfs(i+1, y+1);
for (int j = 1; j <= n; j++)
{
tmp[j] = tmp2[j];
if (J[j][x] == 1 && f[j][x] >= i)
flag[j][y+1] = 0;
}
}
}
int main()
{
m = read(); n = read(); k = read();
for (int i = 1; i <= m; i++) b[i].x = read(), b[i].y = read();
for (int i = 1; i <= n; i++) a[i].x = read(), a[i].y = read();
for (int i = 1; i <= m; i++)
for (int j = 1; j <= n; j++)
if (pow2(a[j].x-b[i].x)+pow2(a[j].y-b[i].y) <= pow2(k)) J[j][i] = 1;
for (int i = 1; i <= n; i++)
for (int j = m; j >= 1; j--)
if (J[i][j]) f[i][j] = max(j, f[i][j+1]);
memset(g, 0x3f, sizeof(g));
g[m+1] = 0;
for (int i = m; i >= 1; i--)
for (int j = 1; j <= n; j++)
if (J[j][i]) g[i] = min(g[i], g[f[j][i]+1] + 1);
ans = n;
memset(tmp, -1, sizeof(tmp));
dfs(1, 0);
printf("%d\n", ans);
return 0;
}
::::
然后运行一遍,就能发现输出了
问题 3
没有技巧,就是试答案,最后发现是 P1526,所以答案是
另外,在最后一天时,我关闭了完全隐私保护。
结语
没想到就这么写完了……