House painting
Statement
Goal
You must print true (or false) if you have enough paint to cover the whole inner surface of the house.The paint stock is Q in liters.
There are N rooms in the house.
We'll' assume that
In each room, walls, floor and ceiling must be painted (with one layer).
Don't mind about doors and windows, paint them all!
Input
Line1 : The paint stock in liters Q
Line2 : The number of rooms to be painted N
N next lines : X, Y, Z are the room dimensions in meters
Line2 : The number of rooms to be painted N
N next lines : X, Y, Z are the room dimensions in meters
Output
Constraints
N >= 0
X, Y, Z <=9
X, Y, Z <=
Example
Input
10 2 3 4 3 2 4 2
Output
false
Game modes
Fastest
Test cases
Test 1 Test
Input
10
2
3 4 3
2 4 2
Output
false
Validator 1 Validator
Input
50
2
2 5 3
2 2 2
Output
true
Test 2 Test
Input
26
1
5 6 3
Output
true
Validator 2 Validator
Input
0
1
1 3 8
Output
false
Test 3 Test
Input
53
7
1 4 3
6 3 1
3 8 9
4 7 1
5 7 3
1 6 8
3 5 7
Output
false
Validator 3 Validator
Input
214
7
1 4 3
6 3 1
3 8 9
4 7 1
5 7 3
1 6 8
3 5 7
Output
true
Test 4 Test
Input
42
3
1 4 5
0 7 8
3 4 1
Output
true
Validator 4 Validator
Input
6
3
1 4 5
2 7 0
3 0 1
Output
false
Solution language
Solution
Stub generator input