五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(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的評論 (共 條)

分享到微博請遵守國家法律
花莲市| 墨玉县| 海安县| 九龙城区| 互助| 哈密市| 盐池县| 诸城市| 井陉县| 遵义市| 巍山| 黔江区| 唐山市| 凤庆县| 彩票| 堆龙德庆县| 额敏县| 菏泽市| 盐边县| 依兰县| 永年县| 龙岩市| 灵石县| 河南省| 黎城县| 永善县| 罗源县| 马龙县| 阳春市| 临潭县| 临海市| 花莲市| 邯郸市| 台东县| 眉山市| 海兴县| 旅游| 宜川县| 女性| 政和县| 龙门县|