-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTimeManagement.cpp
More file actions
53 lines (41 loc) · 1.15 KB
/
TimeManagement.cpp
File metadata and controls
53 lines (41 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <iostream>
#include <vector>
using namespace std;
int main(){
int numberOfApp{0};
cin >> numberOfApp;
int p[numberOfApp], q[numberOfApp], m[numberOfApp];
int i{0};
vector<vector<int>> timeInterval(numberOfApp);
vector<int> finalResult;
while(i < numberOfApp){
cin >> p[i] >> q[i] >> m[i];
int resultCheck{0};
int sum{0};
int j{0};
while(j < 2 * m[i]){
int temp{0};
int tempResult{0};
cin >> temp;
timeInterval[i].push_back(temp);
if(j%2 == 1){
tempResult = temp - timeInterval[i][j-1];
sum += tempResult;
}
if(tempResult > q[i] && resultCheck != 1){
finalResult.push_back(0);
resultCheck = 1;
}
j++;
}
if(sum > p[i] && resultCheck != 1){
finalResult.push_back(0);
}
else if(resultCheck == 0){
finalResult.push_back(1);
}
i++;
}
for(int x : finalResult){
cout<<x;
}