hihocoder 1057 : Performance Log
来源:互联网 发布:万国数据是外企吗 编辑:程序博客网 时间:2024/06/05 08:56
原题地址
分析地址
- 样例输入
8FuncA 00:00:01 STARTFuncB 00:00:02 STARTFuncC 00:00:03 STARTFuncC 00:00:04 ENDFuncB 00:00:05 ENDFuncD 00:00:06 STARTFuncD 00:00:07 ENDFuncA 00:00:08 END
- 样例输出
FuncA 00:00:07FuncB 00:00:03FuncC 00:00:01FuncD 00:00:01
描述
You are given a txt file, which is performance logs of a single-threaded program.
Each line has three columns as follow:
[Function Name] [TimeStamp] [Action]
[FunctionName] is a string of length between 1~255
[TimeStamp] format is hh:mm:ss
Valid values for "Action" column are START or END, marking the start or end of a function call.
Each function will only be called once.
Output the depth-first traversal result of the call graph with the total time of each function call. However, sometimes the performance log isn't correct and at that time you just need to output "Incorrect performance log".
输入
The input only contains 1 case, first line is a positive number N representing the number of logs(1 <= N <= 20000), then there are N lines in next, each line is the log info containing [Function Name] [TimeStamp] [Action], [Function Name] is a string, you can assume the [Function Name] is distinct and the length between 1~255.
输出
Output the depth-first traversal result of the call graph with the total time of each function call for the correct performance, or output "Incorrect performance log".
提示
A call graph is a directed graph that represents calling relationships between subroutines in a computer program.
Call graph for the sample input is shown as below:
Another sample test case.
Sample InputSample Output8FuncA 00:00:01 START
FuncB 00:00:02 START
FuncC 00:00:03 START
FuncA 00:00:04 END
FuncB 00:00:05 END
FuncD 00:00:06 START
FuncD 00:00:07 END
FuncC 00:00:08 ENDIncorrect performance log
- hihocoder 1057 : Performance Log
- hihocoder 1057 : Performance Log
- hihoCoder #1057 : Performance Log
- 【hihocoder】 Performance Log
- Performance Log
- #1057 : Performance Log 线程日志(栈模拟)
- 如何分析Performance Monitor (PerfMon) Log
- 题目1 : Performance Log--微软题目
- hiho一下 第五十九周 Performance Log
- hihocoder #1057
- hiho一下 第五十九周 题目1 : Performance Log
- printk打印log过多会导致performance下降
- Performance
- Performance
- Performance
- Performance
- performance
- hihocoder:
- 被误解的MVC和被神化的MVVM
- hadoop配置文件加载机制
- error while loading shared libraries的解決方法
- JNI学习笔记
- 机器学习是如何运作的?谷歌来告诉你
- hihocoder 1057 : Performance Log
- OpenGL ES 2.0总结(2)-纹理
- ViewPager引用错误的资源地址的图片导致的OOM问题
- mysql 中某一列字符串中特定字符以后的内容
- Oracle 11g中CTE应用示例
- 解决 anyconnect was net able to establish a connection to the specified secure gateway
- strcpy_s 与 strcpy 的用法
- show_rle_picture
- Linux上如何查看某个进程的线程