国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

CF 1779A - Hall of Fame

2023-07-18 14:54 作者:您是打尖兒還是住店呢  | 我要投稿

Thalia is a Legendary Grandmaster in chess. She has n trophies in a line numbered from 1 to n (from left to right) and a lamp standing next to each of them (the lamps are numbered as the trophies).

A lamp can be directed either to the left or to the right, and it illuminates all trophies in that direction (but not the one it is next to). More formally, Thalia has a string s consisting only of characters 'L' and 'R' which represents the lamps' current directions. The lamp i illuminates:

trophies 1,2,…,i?1 if si is 'L';trophies i+1,i+2,…,n if si is 'R'.

She can perform the following operation at most once:


Choose an index i (1≤i<n);Swap the lamps i and i+1 (without changing their directions). That is, swap si with si+1.

Thalia asked you to illuminate all her trophies (make each trophy illuminated by at least one lamp), or to tell her that it is impossible to do so. If it is possible, you can choose to perform an operation or to do nothing. Notice that lamps cannot change direction, it is only allowed to swap adjacent ones.

----------------------------------------------------------

塔利亞是一位傳奇的國際象棋大師。 她有 n 個獎杯,排成一排,編號從 1 到 n(從左到右),每個獎杯旁邊都立著一盞燈(燈被編號為獎杯)。

一盞燈可以指向左側(cè)或右側(cè),它會照亮該方向上的所有獎杯(但不會照亮旁邊的獎杯)。 更正式地說,Thalia 有一個僅由字符“L”和“R”組成的字符串 s,表示燈的當(dāng)前方向。 燈 i 亮起:

如果 si 為“L”,則獎杯 1,2,…,i?1;如果 si 為“R”,則獎杯 i+1,i+2,…,n。

她最多可以執(zhí)行一次以下操作:


選擇一個索引i(1≤i<n);交換燈i和i+1(不改變它們的方向)。 即,將si 與si+1 交換。

塔莉亞要求你照亮她所有的獎杯(讓每個獎杯至少被一盞燈照亮),或者告訴她這是不可能的。 如果可能,您可以選擇執(zhí)行操作或不執(zhí)行任何操作。 請注意,燈不能改變方向,只能交換相鄰的燈。

-------------------------------------------

substring卡了下,啊,我的腦仁啊。。。


CF 1779A - Hall of Fame的評論 (共 條)

分享到微博請遵守國家法律
新河县| 宜兰县| 杭锦后旗| 岐山县| 兴安县| 措勤县| 永顺县| 祁门县| 万荣县| 富阳市| 乐亭县| 静安区| 灵石县| 黑龙江省| 乌苏市| 嵊泗县| 琼中| 青龙| 扶风县| 鸡泽县| 财经| 阿图什市| 醴陵市| 孝昌县| 封丘县| 巨野县| 武夷山市| 昭苏县| 昌平区| 塔城市| 山西省| 裕民县| 伽师县| 万盛区| 临沭县| 新巴尔虎左旗| 镇沅| 宝坻区| 潼南县| 象山县| 鹤壁市|