#K46487. Maximum Resource Usage of an Application
Maximum Resource Usage of an Application
Maximum Resource Usage of an Application
You are given T time intervals. During each interval, a set of applications report their CPU and Memory usages. For each interval, you will first receive an integer A denoting the number of applications, followed by A lines each containing the application name (a string), its CPU usage (an integer) and its Memory usage (an integer).
After processing all intervals, you are given the name of a target application. Your task is to determine the maximum CPU and Memory usage for that application among all intervals. If the target application is not found in any interval, you should output Application Not Found
.
The mathematical formulation can be stated as follows:
Let \(\{(c_{ij}, m_{ij})\}\) denote the CPU and Memory usage for application \(j\) in interval \(i\) for which the application name matches the target. You are required to compute
\[ \max_{i,j} c_{ij} \quad \text{and} \quad \max_{i,j} m_{ij} \]
If no such \(c_{ij}\) and \(m_{ij}\) exist, output Application Not Found
.
inputFormat
The input is provided via standard input and has the following format:
- The first line contains an integer T, the number of time intervals.
- For each interval:
- The first number is an integer A representing the number of applications in that interval.
- This is followed by A lines, each containing an application name (string), CPU usage (integer), and Memory usage (integer) separated by spaces.
- The last line of the input contains the target application's name.
outputFormat
Output a single line to standard output. If the target application is found, print two integers separated by a space representing the maximum CPU usage and maximum Memory usage for that application. If the target application is not found in any interval, output Application Not Found
.
3
2
App1 50 100
App2 30 200
3
App1 60 150
App2 40 180
App3 25 80
1
App2 20 90
App1
60 150
</p>