# Red and Blue and Green ## 題敘: 今天asiansexyboi發現了一個酷數列<$a_n$> 想要跟reset007分享 可是reset007正在打音遊 而且打得很爛 一氣之下就把數列每個數都塗成紅藍綠三個顏色之一  結果asiansexyboi竟然更興奮了 因為他發現有些數字不但有著同樣的顏色 它們形成的子序列竟然只增不減! 他稱這種子序列為「PureMemory」 現在asiansexyboi想要更進一步的找出最長的PureMemory 請你寫個程式幫幫他 ## 輸入說明 第一行是一個正整數$N$ 代表數列的長度 第二行有$N$個數$a_1\ a_2\ ...\ a_n$ 代表asiansexyboi的數列 第三行有$N$個字元$c_1\ c_2\ ...\ c_n$ 代表reset007把$a_i$塗成$c_i$色 字元$c_i$只會是小寫英文 $1 \le N \le 2\times10^5$ $1 \le a_i \le 10^9$ ## 輸出說明 第一行輸出最長的PureMemory長度 第二行輸出它的顏色 如果有多種顏色同時是答案 請輸出ascii碼最大的 ## 範例測資: ``` 7 1 2 3 4 5 6 7 r r g g r g b ``` ## 範例輸出: ``` 3 r ``` ## hint: 顏色會讓你眼花 ## 部份給分: 5%測資:$N\le 3$, 顏色只有$r$ 14%測資:$N\le 20$, 顏色只有$r$ 50%測資:$N\le 1000$, 顏色只有$r$ 15%測資:$N\le 2\times 10^5$, 顏色只有$r$ 15%測資:$N\le 2\times 10^5$, 顏色只有$r, g, b$ 1%測資:$N\le 2\times 10^5$, 狂暴化的reset007把數列重新塗成26種不同顏色($a$~$z$) ###### tags: `MDCPP`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up