luogu#P7955. [COCI 2014/2015 #6] NIKO
[COCI 2014/2015 #6] NIKO
Background
In 2018, in Russia, the 21st World Cup.
Problem Description
For convenience, let represent a defensive player, represent a midfielder, and represent an attacking player.
The coach has several formation plans , where are the counts of respectively. Of course, it must hold that .
Now, each of the players can play some of the roles among . The coach wants to know whether each of his formation plans can be achieved.
Input Format
The first line contains an integer , indicating the number of the coach's plans.
The next lines each contain three integers , describing each plan.
The next line contains an integer , indicating the number of players.
The next lines describe the roles that each player can play.
Output Format
Output lines in total.
- If the -th plan can be satisfied, output
DAon the -th line. - Otherwise, output
NE.
2
4-4-2
10-0-0
10
O
O
O
O
O
O
O
O
ON
NO
NE
DA
3
4-4-2
3-5-2
4-3-3
11
OV
OV
OVN
OV
OV
V
V
N
O
O
O
DA
DA
NE
Hint
Explanation for Sample 1
Obviously, the coach can only use 10-0-0.
Explanation for Sample 2
- For 4-4-2, players can be assigned as , players can be assigned as , and players can be assigned as .
- For 3-5-2, players can be assigned as , players can be assigned as , and players can be assigned as .
- For 4-3-3, it is impossible, because only players can be .
Constraints
For of the testdata, , .
Notes
According to the original configuration, the full score is 80 points.
Translated from COCI 2014-2015 Contest #6 Task B NIKO.
Translated by ChatGPT 5