欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
SIMD12C.文件系统
文件系统
Statement
Simulate a file system containing directories and ordinary files. The root path is /. Names contain lowercase letters and digits. Every operation is valid: referenced paths exist, creations do not conflict, a directory is never moved into its own subtree, and the root is never removed or moved.
Commands are MK path, TOUCH path s, RM path, MV src dst, and Q path. A query path is always a directory and asks for the number of ordinary files in its full subtree and their total size. Moving changes all paths below the moved object. Directory depth never exceeds .
Input
The first line contains (). The following lines contain commands. The total length of all paths is at most , and file sizes are at most .
Output
For each query, print the number of ordinary files in the directory subtree and their total size.
Samples
Sample 1
Input:
10
MK /a
MK /b
TOUCH /a/x 5
MK /a/c
TOUCH /a/c/y 7
Q /a
MV /a/c /b
Q /a
Q /b
RM /a/x
Output:
2 12
1 5
1 7
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |