No.177 I'm Production Assistant Aoi Miyamori!
タグ : / 解いたユーザー数 204
作問者 :
Problem Statement
Aoi Miyamori, a rookie production assistant, had \(W\) cuts (drawings) on her hands that had to be finished within 2 days.
So she decided to make the following request to \(N\) key animators and \(M\) animation directors. (Key animators are the people who draw cuts, and animation directors are the people who finish cuts.)
On day 1, the \(N\) key animators draw cuts, and on day 2, the \(M\) animation directors finish those cuts.
The \(i\)-th key animator can draw \(J_i\) cuts per day.
The \(i\)-th animation director can finish \(C_i\) cuts per day.
Unfortunately, however, the art style of the \(i\)-th animation director does not match that of \(Q_i\) key animators (\(X_1,\ X_2,\ \cdots\ ,X_{Q_i}\)), and the director cannot finish cuts drawn by those \(Q_i\) key animators.
Worried about whether the rookie production assistant Aoi Miyamori can successfully finish the \(W\) cuts, you decided to write a program to determine it.
Input
\(W\)
\(N\)
\(J_1\ J_2\ \cdots\ J_N \)
\(M\)
\(C_1\ C_2\ \cdots\ C_M \)
\(Q_1\ X_{1,1}\ X_{1,2}\ \cdots\ X_{1,Q_1} \)
\(Q_2\ X_{2,1}\ X_{2,2}\ \cdots\ X_{2,Q_2} \)
\(\vdots\)
\(Q_M\ X_{M,1}\ X_{M,2}\ \cdots\ X_{M,Q_M} \)
\(1 \leq W \leq 10000 \) : the number of cuts Aoi Miyamori has on her hands
\(1 \leq N \leq 50\) : the number of key animators
\(1 \leq M \leq 50\) : the number of animation directors
\(0 \leq J_i \leq 10000 \) : the amount the \(i\)-th key animator can draw per day
\(0 \leq C_i \leq 10000 \) : the amount the \(i\)-th animation director can finish per day
\(0 \leq Q_i \leq N \) : the number of key animators the \(i\)-th animation director does not match with
\(1 \leq X_{i,j} \leq N \) : \(X_{i,j} = k\) means that the art of the \(i\)-th animation director and the $k$-th key animator does not match
\(X_{i,j} < X_{i,j+1}\)
Output
Print "SHIROBAKO" if Aoi Miyamori can successfully finish the \(W\) cuts, and "BANSAKUTSUKITA" otherwise.
Don't forget the newline.
Sample
Sample 1
Input
1 1 10 1 100 1 1
Output
BANSAKUTSUKITA
The art styles of the animation director and the key animator do not match, so the drawings by the key animator cannot be finished.
Sample 2
Input
100 10 2 4 6 8 10 12 14 16 18 20 2 50 70 5 6 7 8 9 10 5 1 2 3 4 5
Output
SHIROBAKO
Assign the work to the key animators as follows.
2, 4, 6, 8, 10, 2, 14, 16, 18, 20
The 1st animation director finishes the 30 cuts by the 1st through 5th key animators,
and the 2nd animation director finishes the 70 cuts by the 6th through 10th key animators.
Somehow, the 100 cuts could be finished.
Sample 3
Input
101 10 2 4 6 8 10 12 14 16 18 20 2 50 70 5 6 7 8 9 10 5 1 2 3 4 5
Output
BANSAKUTSUKITA
We've run out of options!!
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。