AtCoder Grand Contest 053
A
>< again
AtCoder
⌀ 1339
原题
←B →
翻译中…

Problem Statement

翻译中…

We have a string $S$ of length $N$, where each character is < or >.

翻译中…

A non-negative integer sequence of $N+1$ elements, $X_0,X_1,\ldots,X_N$, is said to be good when it satisfies the following for every $1 \leq i \leq N$:

翻译中…
  • $X_{i-1}<X_i$, if $S_i$ is <;
  • $X_{i-1}>X_i$, if $S_i$ is >.
翻译中…

Given a good non-negative integer sequence $A$, divide it into as many good non-negative integer sequences as possible. That is, find a positive integer $k$ and $k$ good non-negative integer sequences $B_1,B_2,\ldots, B_k$ satisfying the following with the maximum possible value of $k$:

翻译中…
  • For every $0 \leq i \leq N$, the sum of the $i$-th elements of $B_1,\ldots,B_k$ equals $A_i$.
翻译中…

Constraints

翻译中…
  • $1 \leq N \leq 100$
  • $0 \leq A_i \leq 10^4$
  • $S$ is a string of length $N$ consisting of < and >.
  • $A$ is a good non-negative integer sequence. Particularly, $A$ has $N+1$ elements.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N
S
A_0 A_1 \cdots A_N

翻译中…

Output

翻译中…

Print your answer to Standard Output in the following format:

翻译中…

k
B_{1,0} B_{1,1} \cdots B_{1,N}
:
B_{k,0} B_{k,1} \cdots B_{k,N}

翻译中…

Here, $B_{i,j}$ denotes the value of the $j$-th element of the good non-negative integer sequence $B_i$.

翻译中…

样例

Input #1
3
<><
3 8 6 10
Output #1
2
1 5 4 7
2 3 2 3
题目信息
题号
agc053_a
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。