题面
来源:FrontierCS 官方 statement.txt,与模型收到的题面相同。
# A=B
**Input file:** standard input
**Output file:** standard output
**Time limit:** 1 second
**Memory limit:** 512 megabytes
Marisa has learned an interesting language called **A=B**. She finds that this language has the advantages of simple syntax, easy to learn and convenient to code.
Here is the user manual of A=B:
*(Note that it may differ from the original game “A=B”. So please read the statement carefully.)*
---
## Instruction set
A=B’s instruction set includes:
1. `string1=string2`
Find the leftmost occurrence of `string1` in the string and replace it with `string2`.
2. `string1=(return)string2`
If `string1` is found, replace the entire string with `string2` and end the program immediately.
---
## Program structure
- An A=B program consists of several lines of instructions.
- Each line must include exactly one equal sign (`=`).
- Following characters are reserved: `=`, `(`, `)`.
---
## Execution order
1. Read the input string.
2. Starting from the topmost line, find the first line that can be executed.
3. If found, execute that line and go to step 2.
4. If none is found, return the current string as output.
---
Marisa once introduced A=B to Alice. However, “You called this a programming language? You can’t even write a program that can check if string *t* is a substring of string *s*!” said Alice.
Now Marisa comes to you for help. She wants you to design an A=B program for this problem and show A=B’s efficiency.
---
## Requirements
Your program needs to meet the following requirements:
- Read the input string (the input format is `sSt`. `S` is the separator. `s` and `t` are two non-empty strings consisting of characters `a`, `b`, `c`).
- If `t` is a substring of `s`, the program should return **1** as output, else return **0** as output.
- The character set that your program can use is `{a–z, A–Z, 0–9, =, (, )}`.
- Remember: `=`, `(`, `)` are reserved characters in A=B and you can’t use them in `string1` or `string2`.
- In the instruction format, the length of `string1` and `string2` should be at most 3.
- Suppose the length of the input string is `L`, then:
- The number of instruction executions can’t exceed `2 * max(2L^2, 50)`.
- The length of the string during execution can’t exceed `2 * (2L + 10)`.
- The number of instructions in your A=B program can’t exceed **1000**.
---
## Input
Input an integer `Tid` (`0 ≤ Tid ≤ 2×10^9`). It is used for generating test sets and may be no use to you.
---
## Output
Output your A=B program containing several lines of instructions.
The number of tests will not exceed 20. In each test, the checker will use `Tid` in the input file to generate several lines of input strings and their corresponding answers.
Your A=B program is considered correct **iff** for each input string in all tests, your A=B program gives the correct output.
It’s guaranteed that for each input string in all tests, the length `L` satisfies `3 ≤ L ≤ 1000`.
---
## Examples
### Example 1
**Input**
```
114514
```
**Output**
```
514=(return)1
=514
```
---
### Example 2
**Input**
```
1919810
```
**Output**
```
S=Sakuya
=(return)0
```
---
### Example 3
**Input**
```
caba
```
**Output**
```
aabc
```
**Input**
```
cbacab
```
**Output**
```
aabbcc
```
**Program**
```
ba=ab
ca=ac
cb=bc
```
---
### Example 4
**Input**
```
bababb
```
**Output**
```
b
```
**Input**
```
aababbaa
```
**Output**
```
a
```
**Program**
```
ba=ab
ab=
bb=b
aa=a
```
---
### Example 5
**Input**
```
abc
```
**Output**
```
true
```
**Input**
```
cabc
```
**Output**
```
false
```
**Input**
```
ca
```
**Output**
```
false
```
**Program**
```
b=a
c=a
aaaa=(return)false
aaa=(return)true
=(return)false
```
---
### Example 6
**Input**
```
10111+111
```
**Output**
```
11110
```
**Input**
```
101+10110
```
**Output**
```
11011
```
**Program**
```
A0=0A
A1=1A
B0=0B
B1=1B
0A=a
0B=b
1A=b
1B=ca
A=a
B=b
ac=b
bc=ca
0+=+A
1+=+B
+=
0c=1
1c=c0
c=1
a=0
b=1
```
---
## Note
- The first and second examples show how you should submit your answer.
- Examples 3–6 provide sample problems and their corresponding A=B programs to help you get familiar with the A=B language. Not all of them satisfy the problem’s constraints.
## Scoring
For Tid divisible by 100, the checker validates the submitted program syntax and then accepts it for 100 points without executing generated test strings. No currently released test case uses Tid divisible by 100. The execution-based rules below apply to the other test identifiers.
Let x be E, the number of executed instructions in a test string. C=max(2*l*l,50), where l is the initial string length. The execution limit remains 2*C; program-length and correctness requirements still apply. The physical reference (the 60-point level) is a=C. Define the lower-band continuation:
L(x) = 60*max(0,(2*C-x)/C).
For positive x and positive physical reference a, define the improvement factor r=a/x. The physical reference has r=1 and earns 60 points. For a valid output on this branch, the points P are:
P = 100, if x=0;
P = L(x), if L(x)<=60;
P = min(100,60+ln(r)), otherwise.
Here ln is the natural logarithm. In the upper branch before the 100-point cap, r=exp(P-60): each additional point requires an e-fold improvement in the physical objective (division by e). All feasibility, correctness, and hard resource-limit checks remain required; invalid output receives 0.
Score each subcase separately and take their arithmetic mean.
Across test files, use the arithmetic mean of the file scores.
结果
Kimi K3.1 ProKimi
max
61.4
平均得分 ↑
- 61.4采样 1 · 部分分
- 23.7k平均输出 token(含思考) ↓
- 23.5输出速度 tokens/s ↑
- 1011 秒延迟 ↓
Kimi K3.1 Pro(high)Kimi high
high
0.0
平均得分 ↑
- 0.0采样 1 · 答案错误
- 22.1k平均输出 token(含思考) ↓
- 22.7输出速度 tokens/s ↑
- 975 秒延迟 ↓
DeepSeek Flash V4.1-1017DeepSeek
auto(high)
0.0
平均得分 ↑
- 0.0采样 1 · 答案错误
- 69.0k平均输出 token(含思考) ↓
- 180.3输出速度 tokens/s ↑
- 383 秒延迟 ↓
MiniMax M3.1 FlashMiniMax
auto(max)
0.0
平均得分 ↑
- 0.0采样 1 · 答案错误
- 70.3k平均输出 token(含思考) ↓
- 78.9输出速度 tokens/s ↑
- 892 秒延迟 ↓
↑ 越大越好,↓ 越小越好。得分 0–100,按官方时限判定,所有测试点都满分才算解出。CPU 时间 / 官方解为解出的答案在官方解最慢的 3 个测试点上的 CPU 时间之比(几何平均),只比较官方解至少需要 0.05 秒的题;复杂度按增长幂次相对官方解分类。判题与计分见 原理。
代码
Kimi K3.1 Pro · 采样 1 · 77 行
#include <bits/stdc++.h> using namespace std; int main() { long long Tid; cin >> Tid; cout << R"(Sa=XR Sb=YR Sc=ZR aX=XMa bX=XMb cX=XMc aY=YMa bY=YMb cY=YMc aZ=ZMa bZ=ZMb cZ=ZMc X=BU Y=BV Z=BW MR=R UMa=aNU UMb=bU UMc=cU VMa=aV VMb=bNV VMc=cV WMa=aW WMb=bW WMc=cNW Ua=aU Ub=bU Uc=cU Va=aV Vb=bV Vc=cV Wa=aW Wb=bW Wc=cW URa=IR URb=JR URc=KR VRa=IR VRb=JR VRc=KR WRa=IR WRb=JR WRc=KR UR=F VR=F WR=F aI=Ia bI=Ib cI=Ic aJ=Ja bJ=Jb cJ=Jc aK=Ka bK=Kb cK=Kc NI=IM NJ=JM NK=KM BI=BU BJ=BV BK=BW NF=(return)1 BF=(return)0 aF=Fa bF=Fb cF=Fc =(return)0 )"; return 0; }
Kimi K3.1 Pro(high) · 采样 1 · 97 行
#include <bits/stdc++.h> using namespace std; int main() { long long Tid; cin >> Tid; cout << R"(Ia=XaI Ib=XbI Ic=XcI IS=ZP Paa=Aa Pab=Ab Pac=Ac Pba=Ba Pbb=Bb Pbc=Bc Pca=Ca Pcb=Cb Pcc=Cc Taa=Da Tab=Db Tac=Dc Tba=Ea Tbb=Eb Tbc=Ec Tca=Fa Tcb=Fb Tcc=Fc Pa=G Pb=H Pc=J Ta=G Tb=H Tc=J Xa=aY Xb=b Xc=c XZ=Z A=T Xa=a Xb=bY Xc=c XZ=Z B=T Xa=a Xb=b Xc=cY XZ=Z C=T Ya=aX Yb=b Yc=c YZ=Z D=P Ya=a Yb=bX Yc=c YZ=Z E=P Ya=a Yb=b Yc=cX YZ=Z F=P Xa=(return)1 Ya=(return)1 Xb=b Yb=b Xc=c Yc=c XZ=Z YZ=Z G=U Xb=(return)1 Yb=(return)1 Xa=a Ya=a Xc=c Yc=c XZ=Z YZ=Z H=U Xc=(return)1 Yc=(return)1 Xa=a Ya=a Xb=b Yb=b XZ=Z YZ=Z J=U U=(return)0 =I )"; return 0; }
DeepSeek Flash V4.1-1017 · 采样 1 · 75 行
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); // Read Tid (ignored) long long Tid; if (cin >> Tid) {} vector<string> rules = { "S=X S Z E", "a X=X a", "b X=X b", "c X=X c", "X a=X Y a", "X b=X Y b", "X c=X Y c", "E a=a E", "E b=b E", "E c=c E", "E=$", "Z $=(return)1", "Y S=(return)0", "Y a=Y A a", "Y b=Y B b", "Y c=Y C c", "A a=a A", "A b=b A", "A c=c A", "A S=S A", "B a=a B", "B b=b B", "B c=c B", "B S=S B", "C a=a C", "C b=b C", "C c=c C", "C S=S C", "A Z=Z A", "B Z=Z B", "C Z=Z C", "A a=a", "B b=b", "C c=c", "Y a=a Y", "Y b=b Y", "Y c=c Y", "Z a=a Z", "Z b=b Z", "Z c=c Z", "Z A=Z' M", "Z B=Z' M", "Z C=Z' M", "a Z'=Z' a", "b Z'=Z' b", "c Z'=Z' c", "S Z'=S Z", "a M=M a", "b M=M b", "c M=M c", "S M=M S", "Z M=M Z", "Y M a=Y", "Y M b=Y", "Y M c=Y" }; for (const string& s : rules) { cout << s << '\n'; } return 0; }
MiniMax M3.1 Flash · 采样 1 · 90 行
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); long long Tid; if (!(cin >> Tid)) return 0; cout << "DY=(return)1\n"; cout << "EY=(return)1\n"; cout << "FY=(return)1\n"; cout << "WZ=(return)0\n"; cout << "S=XYZ\n"; for (char c : string("abc")) cout << c << "XY=XY" << c << '\n'; for (char p : string("ABC")) { for (char c : string("abc")) cout << c << p << "K=" << p << "K" << c << '\n'; } for (char p : string("ABC")) cout << "Y" << p << "K=" << p << "Y\n"; cout << "Za=AKZ\n"; cout << "Zb=BKZ\n"; cout << "Zc=CKZ\n"; cout << "Ya=Yg\n"; cout << "Yb=Yh\n"; cout << "Yc=Yi\n"; cout << "Wa=g\n"; cout << "Wb=h\n"; cout << "Wc=i\n"; cout << "Yg=gY\n"; cout << "Yh=hY\n"; cout << "Yi=iY\n"; for (char v : string("ghi")) { for (char p : string("ABCDEF")) cout << p << v << '=' << v << p << '\n'; } cout << "Xg=X3\n"; cout << "Xh=X4\n"; cout << "Xi=X5\n"; const string states = "ABCDEF"; for (int q = 0; q < 6; ++q) { const int text = q % 3; const int carry = q / 3; for (int p = 0; p < 6; ++p) { const int expected = p % 3; const int oldActive = p / 3; const int newActive = carry && (text == expected); const int newIndex = newActive ? 3 + expected : expected; const char newState = states[newIndex]; cout << char('0' + q) << states[p] << 'Y' << '=' << newState << "YW\n"; } } for (int q = 0; q < 6; ++q) { const int text = q % 3; const int carry = q / 3; for (int p = 0; p < 6; ++p) { const int expected = p % 3; const int oldActive = p / 3; const int newActive = carry && (text == expected); const int newIndex = newActive ? 3 + expected : expected; const char newState = states[newIndex]; const char nextScanner = char('0' + text + (oldActive ? 3 : 0)); cout << char('0' + q) << states[p] << '=' << newState << nextScanner << '\n'; } } return 0; }