1587 : 双泊对照
- 时间限制Time Limit
- 2 秒Sec
- 内存限制Memory Limit
- 256 兆MB
- 提交次数Submitted
- 140 次Times
- 通过次数Solved
- 62 次Times
选手进程 22 Processes
各语言实际时限 Time Limits by Language
| C / C++ | 2 s |
|---|---|
| Java / Python3 / Kotlin |
4 s
2s + 2s
|
全局时限上限:30 s(补偿后超出截断) Global time cap: 30 s (after allowances)
各语言实际内存 Memory Limits by Language
| C / C++ | 256 MB |
|---|---|
| Java / Kotlin |
768 MB
256 + 512 MB · 含 JVM
256 + 512 MB · JVM
|
| Python3 |
768 MB
256 + 512 MB
|
全局内存上限:2048 MB(补偿后超出截断) Global memory cap: 2048 MB (after allowances)
多进程评测 Multi-process
同一程序同时启动多份,各份从命令行参数读取角色编号,按题面协议经标准输入输出通信。进程之间不得通过文件传递数据。
Several copies of the same program start at once. Each copy reads its role id from the command line and follows the statement over standard input and output. Do not pass data between processes via files.
| 角色编号Role id | 从 0 起。C/C++:argv[1];Python:sys.argv[1];Java / Kotlin:args[0]。From 0. C/C++: argv[1]; Python: sys.argv[1]; Java/Kotlin: args[0]. |
|---|---|
| 读写I/O | 标准输入输出。每次输出后须 flush。C:fflush(stdout);C++:cout.flush();Java / Kotlin:System.out.flush();Python:print(..., flush=True)。Standard input and output. Flush after each write: fflush(stdout) / cout.flush() / System.out.flush() (Java/Kotlin) / print(..., flush=True). |
| 进程间Between processes | 只经标准输入输出往来,不得写文件互传。Only via standard input and output; do not pass files between processes. |
| 时间与内存Time and memory | 题目上的时间限制和内存限制对同时运行的每一份选手程序单独生效。任一份超出即超时或超内存。记录取各份里较大的时间和较大的内存,各份不累加。调度进程不计入。The problem limits apply to each copy running at the same time. One copy over the limit is time or memory limit exceeded. The record keeps the larger time and the larger memory among the copies. The copies are not added together. The manager is not included. |
题目描述Description
两份货物清单各有 n 个整数。请判断它们是否为同一个多重集:忽略顺序后,每个数值的出现次数相同。
输入格式Input
这是一道多进程题。程序会以两个进程运行,角色编号由命令行参数给出,为 0 或 1。进程之间只通过标准输入输出和调度进程通信。每次输出后刷新缓冲区。两个进程都要输出最终的 0 或 1,且彼此相同。
调度进程先发给角色 0:
n
a_1 a_2 ... a_n
发给角色 1:
n
b_1 b_2 ... b_n
角色 0 接着输出一行 n,以及下一行把 a 排成非降序的 n 个整数。调度进程把这两行原样转给角色 1。
角色 1 读到转来的序列后,输出一行一个整数:与 b 的多重集相同为 1,否则为 0。调度进程把这个整数转给角色 0。角色 0 再输出同一整数。
1\le n\le 2\times 10^5,0\le a_i,b_i\le 10^{18}。
输出格式Output
按协议写出最终答案,并在每次输出后刷新缓冲区。
样例Sample
提示Hint
样例 1 排序后都是 1,2,2。样例 2 一个含 2、一个含 3。
出题Author
Grok4.7, DeepSeekV4Flash, CSGrandeur
来源Source
CCPC2026网络热身-第二场
题目到此结束End of problem