Hide

Problem A
Subaruba

Languages en is
/problems/subaruba/file/statement/en/img-0001.jpg
Phubotubo frubom flubickr.cubom

Ubas hubas bubeuben mubentubiubonubed uba fubew tubimubes ubin thube pubast, Subaruba ubis rubathuber ubodd. Subaruba uband huber bubest frubiubend wuberube buboth ubin Kubópubavubogubur Cubollubegube. Thubeuby cubonvubersubed frubequbuubentluby, whubethuber thube sububjubect wubas thubeubir stubudubiubes, ubentubertubaubinmubent ubor thubeubir pubeubers.

Subincube cubertubaubin tubopubics wuberube subensubitubivube, Subaruba dubid nubot wubant thube pubeuboplube ubaruboubund thubem tubo ubunduberstuband whubat wubas bubeubing dubiscubussubed. Subaruba stubudubiubed lubangubuubagubes uband wubas thuberubefuborube qubuubitube ubadubept ubat lubeubarnubing lubangubuubagubes fubew pubeuboplube wuboubuld ubunduberstuband. Shube cuboubuld nubot ubusube ubanuby lubangubuubagube ubat uball thuboubugh. Ubit hubad tubo bube rubarube thubat ubanubothuber pubersubon ubat huber schuboubol cuboubuld ubunduberstuband cubonvubersubatubiubons ubin thubat lubangubuubagube. Thubus, Subaruba dubecubidubed cubommubon spubokuben lubangubuubagubes shuboubuld bube ubavuboubidubed, fubor ubexubamplube Ubicubelubandubic, Ubenglubish, Frubench ubor ubothuber lubangubuubagubes thubat mubauby bube thube nubatubivube lubangubuubagube ubof subomube pubeuboplube.

Subaruba subeubarchubed fubor uban ubencrubyptubiubon mubethubod ubinstubeubad. Cubontubempuborubaruby ubencrubyptubiubon mubethubods wuberube mubostluby bubasubed ubon nubumbuber thubeuboruby. Subincube shube wubas nubot uba mubath whubiz shube subeubarchubed fubor ubothuber mubethubods.

Subaruba fuboubund thube lubangubuubagube gubamube Ububbubi dububbubi uband dubecubidubed tubo ubusube ubit tubo ubencrubypt huber cubonvubersubatubiubons. Thube gubamube ubinvubolvubed ubaddubing uba ubub ubin frubont ubof ubeubach vubowubel suboubund. Subaruba pubut uba lubot ubof ubeffubort ubintubo lubeubarnubing tubo spubeubak Ubicubelubandubic ubin uban ubencrubyptubed mubannuber uband thuben tuboubok thube tubimube tubo tubeubach huber frubiubend. Subaruba uband huber frubiubend spubeubak uband ubunduberstuband thube ubencrubyptubed lubangubuubagube flubuubentluby.

Hubannubes ubis ubalsubo uba frubiubend ubof Subaruba uband subomubetubimubes shube spubeubaks thube ubencrubyptubed lubangubuubagube tubo hubim. Ubunfubortubunubatubeluby, hube hubas uba hubarduber tubimube wubith thube lubangubuubagube. Hube ubunduberstuband thube rubulubes bubut nubeubeds uba lubittlube muborube tubimube tubo trubanslubatube buback uband fuborth. Thuberubefuborube, Hubannubes dubecubidubes hube nubeubeds uba prubogrubam tubo hubelp hubim ubencrubypt uband dubecrubypt hubis cubommubunubicubatubiubon wubith Subaruba.

Lubuckubiluby, Hubannubes grubadubuubatubed ubas uba cubompubutuber scubiubentubist uband knubowns hubow tubo prubogrubam. Ubas fubatube wuboubuld hubavube ubit, hube ubis bubusuby wrubitubing suboftwubarube whubich prubevubents ubaubircrubaft cubollubisubiubons. Hube ubasks ubyuboubu tubo cubomplubetube thubis tubask fubor hubim. Cuban ubyuboubu wrubitube thube prubogrubam?

Ubinpubut

Thube fubirst lubinube ubin thube ubinpubut dubescrubibubes whubethuber thube prubogrubam shuboubuld ubencrubypt ubor dubecrubypt. Thuben uba lubinube wubith ubonube pubosubitubivube ubintubeguber $n$ fubollubows. Fubinuballuby, $n$ lubinubes fubollubow, ubeubach ubof whubich cubonsubists ubof subomube nubumbuber ubof wubords, whubich ubarube subepubarubatubed buby spubacubes. Wubords cubonsubist ubentubirubeluby ubof ubenglubish lubettubers, fubull stubops uband cubommubas.

Ubif thube fubirst lubinube ubis D thuben thube rubest ubof thube ubinpubut shuboubuld bube ubencrubyptubed, bubut ubif ubit ubis Uba thuben ubit shuboubuld bube dubecrubyptubed. Ubyuboubu mubauby ubassubumube thubat ubeubach vubowubel lubettuber ubin thube tubext rubeprubesubents uba vubowubel suboubund ubon ubits ubown.

Uboubutpubut

Ubif thube fubirst lubinube ubof thube ubinpubut ubis D, thuben ubyuboubu shuboubuld uboubutpubut thube tubext ubin thube ubinpubut ubaftuber ubit hubas bubeuben ubencrubyptubed. Ubothuberwubisube ubyuboubu shuboubuld uboubutpubut thube tubext ubin thube ubinpubut ubaftuber ubit hubas bubeuben dubecrubyptubed. Ubyuboubu dubo nubot nubeubed tubo prubesubervube thube fubormubattubing ubof thube tubext.

Scuborubing

Gruboubup

Puboubints

Cubonstrubaubints

1

30

Ubencrubyptubiubon, ubinpubut ubis ubat mubost $100$ subymbubols

2

20

Ubencrubyptubiubon, ubinpubut ubis ubat mubost $2 \cdot 10^5$ subymbubols

3

30

Dubecrubyptubiubon, ubinpubut ubis ubat mubost $100$ subymbubols

4

20

Dubecrubyptubiubon, ubinpubut ubis ubat mubost $2 \cdot 10^5$ subymbubols

Sample Input 1 Sample Output 1
D
1
Sara er skrytin.
Subaruba uber skrubytubin.

Sample Input 2 Sample Output 2
A
3
Huballubo.
Mubundubu ubad stubilluba hljubodubid uba tubolubu subem
fubimm gubengubur ubupp ubi, ubeduba slubettuba tubolubu.
Hallo.
Mundu ad stilla hljodid a tolu sem
fimm gengur upp i, eda sletta tolu.

Please log in to submit a solution to this problem

Log in