Блог пользователя SlavicG

Автор SlavicG, 4 года назад, По-английски

Hello Codeforces!

mesanu, flamestorm, MikeMirzayanov and I are glad to invite you to Codeforces Round 835 (Div. 4)! It starts on Nov/21/2022 17:35 (Moscow time).

The format of the event will be identical to Div. 3 rounds:

  • 5-8 tasks;
  • ICPC rules with a penalty of 10 minutes for an incorrect submission;
  • 12-hour phase of open hacks after the end of the round (hacks do not give additional points)
  • after the end of the open hacking phase, all solutions will be tested on the updated set of tests, and the ratings recalculated
  • by default, only "trusted" participants are shown in the results table (but the rating will be recalculated for all with initial ratings less than 1400 or you are an unrated participant/newcomer).

We urge participants whose rating is 1400+ not to register new accounts for the purpose of narcissism but to take part unofficially. Please do not spoil the contest for the official participants.

Only trusted participants of the fourth division will be included in the official standings table. This is a forced measure for combating unsporting behavior. To qualify as a trusted participant of the fourth division, you must:

  • take part in at least five rated rounds (and solve at least one problem in each of them),
  • do not have a point of 1400 or higher in the rating.

Regardless of whether you are a trusted participant of the fourth division or not, if your rating is less than 1400 (or you are a newcomer/unrated), then the round will be rated for you.

We would like to thank:

We suggest reading all of the problems and hope you will find them interesting!

Good luck!

UPD: Editorial is posted.

  • Проголосовать: нравится
  • +149
  • Проголосовать: не нравится

»
4 года назад, скрыть # |
 
Проголосовать: нравится +28 Проголосовать: не нравится

As a tester, I can assure you really good quality problems. The contest in worth spending time. All the setters and testers have put a lot of work and effort. Good luck everyone !!

  • »
    »
    4 года назад, скрыть # ^ |
     
    Проголосовать: нравится +12 Проголосовать: не нравится

    As a tester, I can assure you really good quality problems. The contest in worth spending time. All the setters and testers have put a lot of work and effort. Good luck everyone !!

    • »
      »
      »
      4 года назад, скрыть # ^ |
       
      Проголосовать: нравится 0 Проголосовать: не нравится

      As a tester, I can assure you really good quality problems. The contest in worth spending time. All the setters and testers have put a lot of work and effort. Good luck everyone !!

      • »
        »
        »
        »
        4 года назад, скрыть # ^ |
         
        Проголосовать: нравится 0 Проголосовать: не нравится

        As a tester, I can assure you really good quality problems. The contest in worth spending time. All the setters and testers have put a lot of work and effort. Good luck everyone !!

        • »
          »
          »
          »
          »
          4 года назад, скрыть # ^ |
           
          Проголосовать: нравится -6 Проголосовать: не нравится

          As a tester, I can assure you really good quality problems. The contest in worth spending time. All the setters and testers have put a lot of work and effort. Good luck everyone !!

          • »
            »
            »
            »
            »
            »
            4 года назад, скрыть # ^ |
             
            Проголосовать: нравится -9 Проголосовать: не нравится

            As a tester, I can assure you really good quality problems. The contest in worth spending time. All the setters and testers have put a lot of work and effort. Good luck everyone !!

            • »
              »
              »
              »
              »
              »
              »
              4 года назад, скрыть # ^ |
               
              Проголосовать: нравится 0 Проголосовать: не нравится

              As a tester, I can assure you really good quality problems. The contest in worth spending time. All the setters and testers have put a lot of work and effort. Good luck everyone !!

              • »
                »
                »
                »
                »
                »
                »
                »
                4 года назад, скрыть # ^ |
                ← Rev. 2  
                Проголосовать: нравится -13 Проголосовать: не нравится

                k.,

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  4 года назад, скрыть # ^ |
                   
                  Проголосовать: нравится 0 Проголосовать: не нравится

                  As a tester, I can assure you really good quality problems. The contest in worth spending time. All the setters and testers have put a lot of work and effort. Good luck everyone !!

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  4 года назад, скрыть # ^ |
                  ← Rev. 2  
                  Проголосовать: нравится -28 Проголосовать: не нравится
                  Mihai Eminescu
                  

                  Luceafărul

                  A fost odată ca-n povești, A fost ca niciodată. Din rude mari împărătești, O prea frumoasă fată.

                  Și era una la părinți Și mândră-n toate cele, Cum e Fecioara între sfinți Și luna între stele.

                  Din umbra falnicelor bolți Ea pasul și-l îndreaptă Lângă fereastră, unde-n colț Luceafărul așteaptă.

                  Privea în zare cum pe mări Răsare și străluce, Pe mișcătoarele cărări Corăbii negre duce.

                  Îl vede azi, îl vede mâini, Astfel dorința-i gata; El iar, privind de săptămâni, Îi cade draga fată.

                  Cum ea pe coate-și răzima Visând ale ei tâmple, De dorul lui și inima Și sufletu-i se împle.

                  Și cât de viu s-aprinde el În orișicare sară, Spre umbra negrului castel Când ea o să-i apară.

                  ...

                  Și pas cu pas pe urma ei Alunecă-n odaie, Țesând cu recile-i scântei O mreajă de văpaie.

                  Și când în pat se-ntinde drept Copila să se culce, I-atinge mâinile pe piept, I-nchide geana dulce;

                  Și din oglindă luminiș Pe trupu-i se revarsă, Pe ochii mari, bătând închiși Pe fața ei întoarsă.

                  Ea îl privea cu un surâs, El tremura-n oglindă, Căci o urma adânc în vis De suflet să se prindă.

                  Iar ea vorbind cu el în somn, Oftând din greu suspină: - O, dulce-al nopții mele domn, De ce nu vii tu? Vină!

                  Cobori în jos, luceafăr blând, Alunecând pe-o rază, Pătrunde-n casă și în gând Și viața-mi luminează!

                  El asculta tremurător, Se aprindea mai tare Și s-arunca fulgerător, Se cufunda în mare;

                  Și apa unde-au fost căzut În cercuri se rotește, Și din adânc necunoscut Un mândru tânăr crește.

                  Ușor el trece ca pe prag Pe marginea ferestei Și ține-n mână un toiag Încununat cu trestii.

                  Părea un tânăr voievod Cu păr de aur moale, Un vânăt giulgi se-ncheie nod Pe umerele goale.

                  Iar umbra feței străvezii E albă ca de ceară - Un mort frumos cu ochii vii Ce scânteie-n afară.

                  • Din sfera mea venii cu greu Ca să-ți urmez chemarea, Iar cerul este tatăl meu Și mumă-mea e marea.

                  Ca în cămara ta să vin, Să te privesc de-aproape, Am coborât cu-al meu senin Și m-am născut din ape.

                  O, vin'! odorul meu nespus, Și lumea ta o lasă; Eu sunt luceafărul de sus, Iar tu să-mi fii mireasă.

                  Colo-n palate de mărgean Te-oi duce veacuri multe, Și toată lumea-n ocean De tine o s-asculte.

                  • O, ești frumos, cum numa-n vis Un înger se arată, Dară pe calea ce-ai deschis N-oi merge niciodată;

                  Străin la vorbă și la port, Lucești fără de viață, Căci eu sunt vie, tu ești mort, Și ochiul tău mă-ngheață.

                  ...

                  Trecu o zi, trecură trei Și iarăși, noaptea, vine Luceafărul deasupra ei Cu razele-i senine.

                  Ea trebui de el în somn Aminte să-și aducă Și dor de-al valurilor domn De inim-o apucă:

                  • Cobori în jos, luceafăr blând, Alunecând pe-o rază, Pătrunde-n casă și în gând Și viața-mi luminează!

                  Cum el din cer o auzi, Se stinse cu durere, Iar ceru-ncepe a roti În locul unde piere;

                  În aer rumene văpăi Se-ntind pe lumea-ntreagă, Și din a chaosului văi Un mândru chip se-ncheagă;

                  Pe negre vițele-i de păr Coroana-i arde pare, Venea plutind în adevăr Scăldat în foc de soare.

                  Din negru giulgi se desfășor Marmoreele brațe, El vine trist și gânditor Și palid e la față;

                  Dar ochii mari și minunați Lucesc adânc himeric, Ca două patimi fără saț Și pline de-ntuneric.

                  • Din sfera mea venii cu greu Ca să te-ascult ș-acuma, Și soarele e tatăl meu, Iar noaptea-mi este muma;

                  O, vin', odorul meu nespus, Și lumea ta o lasă; Eu sunt luceafărul de sus, Iar tu să-mi fii mireasă.

                  O, vin', în părul tău bălai S-anin cununi de stele, Pe-a mele ceruri să răsai Mai mândră decât ele.

                  • O, ești frumos cum numa-n vis Un demon se arată, Dară pe calea ce-ai deschis N-oi merge niciodată!

                  Mă dor de crudul tău amor A pieptului meu coarde, Și ochii mari și grei mă dor, Privirea ta mă arde.

                  • Dar cum ai vrea să mă cobor? Au nu-nțelegi tu oare, Cum că eu sunt nemuritor, Și tu ești muritoare?

                  • Nu caut vorbe pe ales, Nici știu cum aș începe - Deși vorbești pe înțeles, Eu nu te pot pricepe;

                  Dar dacă vrei cu crezământ Să te-ndrăgesc pe tine, Tu te coboară pe pământ, Fii muritor ca mine.

                  • Tu-mi cei chiar nemurirea mea În schimb pe-o sărutare, Dar voi să știi asemenea Cât te iubesc de tare;

                  Da, mă voi naște din păcat, Primind o altă lege; Cu vecinicia sunt legat, Ci voi să mă dezlege.

                  Și se tot duce... S-a tot dus. De dragu-unei copile, S-a rupt din locul lui de sus, Pierind mai multe zile.

                  ...

                  În vremea asta Cătălin, Viclean copil de casă, Ce umple cupele cu vin Mesenilor la masă,

                  Un paj ce poartă pas cu pas A-mpărătesii rochii, Băiat din flori și de pripas, Dar îndrăzneț cu ochii,

                  Cu obrăjei ca doi bujori De rumeni, bată-i vina, Se furișează pânditor Privind la Cătălina.

                  Dar ce frumoasă se făcu Și mândră, arz-o focul; Ei, Cătălin, acu-i acu Ca să-ți încerci norocul.

                  Și-n treacăt o cuprinse lin Într-un ungher degrabă. - Da' ce vrei, mări Cătălin? Ia du-t' de-ți vezi de treabă.

                  • Ce voi? Aș vrea să nu mai stai Pe gânduri totdeauna, Să râzi mai bine și să-mi dai O gură, numai una.

                  • Dar nici nu știu măcar ce-mi ceri, Dă-mi pace, fugi departe - O, de luceafărul din cer M-a prins un dor de moarte.

                  • Dacă nu știi, ți-aș arăta Din bob în bob amorul, Ci numai nu te mânia, Ci stai cu binișorul.

                  Cum vânătoru-ntinde-n crâng La păsărele lațul, Când ți-oi întinde brațul stâng Să mă cuprinzi cu brațul;

                  Și ochii tăi nemișcători Sub ochii mei rămâie... De te înalț de subsuori Te-nalță din călcâie;

                  Când fața mea se pleacă-n jos, În sus rămâi cu fața, Să ne privim nesățios Și dulce toată viața;

                  Și ca să-ți fie pe deplin Iubirea cunoscută, Când sărutându-te mă-nclin, Tu iarăși mă sărută.

                  Ea-l asculta pe copilaș Uimită și distrasă, Și rușinos și drăgălaș, Mai nu vrea, mai se lasă,

                  Și-i zice-ncet: — Încă de mic Te cunoșteam pe tine, Și guraliv și de nimic, Te-ai potrivi cu mine...

                  Dar un luceafăr, răsărit Din liniștea uitării, Dă orizon nemărginit Singurătății mării;

                  Și tainic genele le plec, Căci mi le umple plânsul Când ale apei valuri trec Călătorind spre dânsul;

                  Lucește c-un amor nespus, Durerea să-mi alunge, Dar se înalță tot mai sus, Ca să nu-l pot ajunge.

                  Pătrunde trist cu raze reci Din lumea ce-l desparte... În veci îl voi iubi și-n veci Va rămânea departe...

                  De-aceea zilele îmi sunt Pustii ca niște stepe, Dar nopțile-s de-un farmec sfânt Ce nu-l mai pot pricepe.

                  • Tu ești copilă, asta e... Hai ș-om fugi în lume, Doar ni s-or pierde urmele Și nu ne-or ști de nume,

                  Căci amândoi vom fi cuminți, Vom fi voioși și teferi, Vei pierde dorul de părinți Și visul de luceferi.

                  ...

                  Porni luceafărul. Creșteau În cer a lui aripe, Și căi de mii de ani treceau În tot atâtea clipe.

                  Un cer de stele dedesubt, Deasupra-i cer de stele - Părea un fulger ne'ntrerupt Rătăcitor prin ele.

                  Și din a chaosului văi, Jur împrejur de sine, Vedea, ca-n ziua cea dentâi, Cum izvorau lumine;

                  Cum izvorând îl înconjor Ca niște mări, de-a-notul... El zboară, gând purtat de dor, Pân' piere totul, totul;

                  Căci unde-ajunge nu-i hotar, Nici ochi spre a cunoaște, Și vremea-ncearcă în zadar Din goluri a se naște.

                  Nu e nimic și totuși e O sete care-l soarbe, E un adânc asemene Uitării celei oarbe.

                  • De greul negrei vecinicii, Părinte, mă dezleagă Și lăudat pe veci să fii Pe-a lumii scară-ntreagă;

                  O, cere-mi, Doamne, orice preț Dar dă-mi o altă soarte, Căci tu izvor ești de vieți Și dătător de moarte;

                  Reia-mi al nemuririi nimb Și focul din privire, Și pentru toate dă-mi în schimb O oră de iubire...

                  Din chaos, Doamne,-am apărut Și m-aș întoarce-n chaos... Și din repaos m-am născut, Mi-e sete de repaos.

                  • Hyperion, ce din genuni Răsai c-o-ntreagă lume, Nu cere semne și minuni Care n-au chip și nume;

                  Tu vrei un om să te socoți Cu ei să te asameni? Dar piară oamenii cu toți, S-ar naște iarăși oameni.

                  Ei numai doar durează-n vânt Deșerte idealuri - Când valuri află un mormânt, Răsar în urmă valuri;

                  Ei doar au stele cu noroc Și prigoniri de soarte, Noi nu avem nici timp, nici loc Și nu cunoaștem moarte.

                  Din sânul vecinicului ieri Trăiește azi ce moare, Un soare de s-ar stinge-n cer S-aprinde iarăși soare;

                  Părând pe veci a răsări, Din urmă moartea-l paște, Căci toți se nasc spre a muri Și mor spre a se naște.

                  Iar tu, Hyperion, rămâi Oriunde ai apune... Cere-mi cuvântul meu dentâi - Să-ți dau înțelepciune?

                  Vrei să dau glas acelei guri, Ca dup-a ei cântare Să se ia munții cu păduri Și insulele-n mare?

                  Vrei poate-n faptă să arăți Dreptate și tărie? Ți-aș da pământul în bucăți Să-l faci împărăție.

                  Îți dau catarg lângă catarg, Oștiri spre a străbate Pământu-n lung și marea-n larg, Dar moartea nu se poate...

                  Și pentru cine vrei să mori? Întoarce-te, te-ndreaptă Spre-acel pământ rătăcitor Și vezi ce te așteaptă.

                  ...

                  În locul lui menit din cer Hyperion se-ntoarse Și, ca și-n ziua cea de ieri, Lumina și-o revarsă.

                  Căci este sara-n asfințit Și noaptea o să-nceapă; Răsare luna liniștit Și tremurând din apă

                  Și umple cu-ale ei scântei Cărările din crânguri. Sub șirul lung de mândri tei Ședeau doi tineri singuri:

                  • O, lasă-mi capul meu pe sân, Iubito, să se culce Sub raza ochiului senin Și negrăit de dulce;

                  Cu farmecul luminii reci Gândirile străbate-mi, Revarsă liniște de veci Pe noaptea mea de patimi.

                  Și de asupra mea rămâi Durerea mea de-o curmă, Căci ești iubirea mea dentâi Și visul meu din urmă.

                  Hyperion vedea de sus Uimirea-n a lor față: Abia un braț pe gât i-a pus Și ea l-a prins în brațe...

                  Miroase florile-argintii Și cad, o dulce ploaie, Pe creștetele-a doi copii Cu plete lungi, bălaie.

                  Ea, îmbătată de amor, Ridică ochii. Vede Luceafărul. Și-ncetișor Dorințele-i încrede:

                  • Cobori în jos, luceafăr blând, Alunecând pe-o rază, Pătrunde-n codru și în gând, Norocu-mi luminează!

                  El tremură ca alte dăți În codri și pe dealuri, Călăuzind singurătăți De mișcătoare valuri;

                  Dar nu mai cade ca-n trecut În mări din tot înaltul: - Ce-ți pasă ție, chip de lut, Dac-oi fi eu sau altul?

                  Trăind în cercul vostru strâmt Norocul vă petrece, Ci eu în lumea mea mă simt Nemuritor și rece.

                  1883, aprilie

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  4 года назад, скрыть # ^ |
                   
                  Проголосовать: нравится 0 Проголосовать: не нравится

                  As a tester, I can assure you really good quality problems. The contest in worth spending time. All the setters and testers have put a lot of work and effort. Good luck everyone !!

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  4 года назад, скрыть # ^ |
                   
                  Проголосовать: нравится 0 Проголосовать: не нравится

                  114 spoilers later: where are them upvotes at?

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  4 года назад, скрыть # ^ |
                   
                  Проголосовать: нравится 0 Проголосовать: не нравится

                  As a tester, I can assure you really good quality problems. The contest in worth spending time. All the setters and testers have put a lot of work and effort. Good luck everyone !!

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  4 года назад, скрыть # ^ |
                   
                  Проголосовать: нравится 0 Проголосовать: не нравится

                  As a maprticipant, I am asking myself: "When will ratings change?"

  • »
    »
    4 года назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    As a tester, I can assure you really good quality problems. The contest in worth spending time. All the setters and testers have put a lot of work and effort. Good luck everyone !!

»
4 года назад, скрыть # |
 
Проголосовать: нравится +17 Проголосовать: не нравится

As a tester, I can assure you really good quality problems. The contest in worth spending time. All the setters and testers have put a lot of work and effort. Good luck everyone !!

»
4 года назад, скрыть # |
 
Проголосовать: нравится +26 Проголосовать: не нравится

As a tester, I am happy to represent my fellow newbies. The round has good and enjoyable problems. Good luck!

»
4 года назад, скрыть # |
 
Проголосовать: нравится +4 Проголосовать: не нравится

As I tester, I'm sure you'll find the problems fun and interesting. I wish good luck and positive delta to everyone!

»
4 года назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

Shouldn't this blog be in the main page?

»
4 года назад, скрыть # |
 
Проголосовать: нравится +4 Проголосовать: не нравится

Looking forward to my first unrated round ever!

»
4 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится -8 Проголосовать: не нравится

As a tester I did nothing like (some) other testers.

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Congratulations once again for putting div.4 round on Monday.

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

omg div 4 , will try to score high

»
4 года назад, скрыть # |
 
Проголосовать: нравится +22 Проголосовать: не нравится

»
4 года назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

Yayyy ! Won't miss my first unrated contest ^_^

»
4 года назад, скрыть # |
 
Проголосовать: нравится -27 Проголосовать: не нравится

It would be nice to finally fix language selector issue and remove excessive use of flags.

Sources with supporting arguments:

Codeforces Language Picker -- chrome extension to see how fixed codeforces language picker would look like.

Please support the initiative and stop reinforcing poor UX practices.

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I just became pupil. How can I become a specialist? Should I learn new things? Please advise me. I want to reach there quickly.

»
4 года назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

omg cyan round

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

OMG Green Round

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I'm really looking forward to this game, it's going to be an interesting game

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Good luck everyone!

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

The funny thing that nobody pointed out is that all the testers are at least expert level. However, it does not have to mean that the problem difficulty was poorly judged, especially because many of the testers and setters are experienced in setting/testing rounds.

»
4 года назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

As a Arch Linux user, how do I exit vim I am still in it since the Div. 3

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

good luck guys <3

»
4 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

aaaaaaaaaa

»
4 года назад, скрыть # |
 
Проголосовать: нравится -16 Проголосовать: не нравится

leetcode monthly contest fun

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

solved 3 problems!!!

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

SpeedForces

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Nice Contest. Enjoyed solving the problems.

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Can someone please tell for which test case my code for D is failing?
https://codeforces.me/contest/1760/submission/181970514

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

What's wrong in my submission for E? Lots of people got testcase 7 WA too

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Sample tests were really bad for E and G!

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I'd really appreciate if someone could help me with the logic for F.

My approach
»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Can anyone help me with my submission for 1760G - SlavicG's Favorite Problem : 182028374.

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

can someone share the idea and intuition behind G?

  • »
    »
    4 года назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    One important property of XOR is that a^a = 0. So if you do two BFS, one rooted at A and one rooted at B, you can find nodes in the A BFS and B BFS where the XOR value is equal, so you can teleport from one path to another and reach B with XOR of 0. If this exists (there are some edge cases to consider), then it is possible.

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

solved all problems in div4 for the 2nd time. feels amazing.

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

What's the 53rd case of second test case in G?

»
4 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

can one explain why in D

10 10 8 10 10 4

output NO ?

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Did any1 else mess up F for the infinity case?

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

My solution (as following) gives wrong answer 2653rd numbers differ - expected: '4', found: '3' for 1760E — Binary Inversions.

Can anyone help me with testcases that gives wrong answer on test 2.

public void solve() {
	int n = in.nextInt();
	int[] a = new int[n];
	int tcount_0 = 0;
	for (int i = 0; i < n; i++) {
		a[i] = in.nextInt();
		if (a[i] == 0)
			tcount_0++;
	}
	long inversions = 0, count_0 = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] == 0)
			count_0++;
		else
			inversions += tcount_0 - count_0;
	}
	long ans = Long.MIN_VALUE;
	long count_1 = count_0 = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] == 0) {
			count_0++;
			ans = Math.max(ans, tcount_0 - count_0 - count_1);
		} else {
			ans = Math.max(ans, count_1 - tcount_0 + count_0);
			count_1++;
		}
	}
	out.println(inversions + ans);
}
»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

My rating is 1400 and my standings show that this contest is rated for me. So, I am a little bit confused that will my rating will change or not ...

»
4 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +2 Проголосовать: не нравится

t seemed like mimemamomu warmuping

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How to solve F?

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Can anyone help in problem G? I'm getting MLE. My Solution

Approach: Starting bfs from 'a' and calculating zor as i move and checking if zor becomes equal to any edge weight that is adjacent to 'b'(so that i will teleport from here).

  • »
    »
    4 года назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    There are too many statements during bfs. You can save the weight of not only the adjacent edge but from any point to "b", so that the amount of statement will be small.

»
4 года назад, скрыть # |
 
Проголосовать: нравится +7 Проголосовать: не нравится

Apologies if this isn't the correct place to raise suspicions, I'm new here and couldn't figure out how to report users.

There is something weird I noticed about this user — https://codeforces.me/submissions/9999999999/contest/1760

You can see him making multiple submissions specifically designed to be hacked if there is a single testcase (on the first and trivial problem). He does it by hardcoding wrong input when there is only 1 test case like so:

if(t==1) cout<<"500949585450"<<endl;

(example submission https://codeforces.me/contest/1760/submission/182047190 )

I'm not sure what the purpose is. Maybe it's a multi-account of the hacker — https://codeforces.me/profile/Adel_Mahmoud and he's just farming points? Can you think of any other explanation?

»
4 года назад, скрыть # |
 
Проголосовать: нравится -17 Проголосовать: не нравится

gimme downvotes pls

»
4 года назад, скрыть # |
 
Проголосовать: нравится +30 Проголосовать: не нравится

So, I promise that as soon as I become pupil, I will try to give my perspective of how I make my solutions, I don't think that my code is worth but maybe my perspective can give you help in the future.

A
B
C
D
E

I hope that was helpful this in some way, sorry if was not as good as you expect, when I became a better, I will make up for these bad tutorials.

  • »
    »
    4 года назад, скрыть # ^ |
    ← Rev. 5  
    Проголосовать: нравится +25 Проголосовать: не нравится

    It's not a bad tutorial. For some formatting tips I would recommend enclosing variables in dollar signs to get the mathematical look of $$$x$$$. You can use a_{x}for $$$a_x$$$ and a^{x} for $$$a^{x}$$$. This is called latex and its quite commonly used in math. You should also use links for your codes instead of pasting them.

    For the solution themselves, you can use some advanced implementation tricks to make the code really simple and bug proof.

    For problem D for example, we see 2 phases. decreasing, then increasing.

    So we can define a phase function like


    vector<int> a(n); ... auto walk_while_decreasing = [&](int start){ while(start + 1 < n && a[start] >= a[start + 1]) ++start; return start; //Similarly for increasing }; int reach = walk_while_increasing(walk_while_decreasing(0)); if(reach == n - 1) //the array consists of these 2 phases else // it doesn't

    You could also get the exact values of $$$l$$$ and $$$r$$$ using the intermediate values of this calculation.

    For problem E you need to only consider the change of inversion. This is the same as number of pairs $$$(i, j)$$$ such that $$$i \lt j$$$ and $$$a_i = 1$$$ and $$$a_j = 0$$$. If we consider what happens when we change a $$$0$$$ at index $$$x$$$ to a $$$1$$$ for example, we get more inversions from the $$$0$$$s to the right of $$$x$$$, and less inversions from the $$$1$$$s to the left of $$$x$$$. Therefore the best $$$0$$$ to flip would be on the left. But this also allows you to calculate the change in inversions from changing any index $$$x$$$.

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Am I the only weirdo who used segment tree to solve C?

  • »
    »
    4 года назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    How did you do it?

    • »
      »
      »
      4 года назад, скрыть # ^ |
       
      Проголосовать: нравится 0 Проголосовать: не нравится

      How do we easily calculate the maximum of all array elements excluding the i-th element? It's possible to just do two range queries in a segment tree (the array part before the i-th element and the array part after the i-th element) and use the largest of these two results. In submission 181925712 I have only written the "main" function. Everything else is a copy of the segment tree implementation from the atcoder library.

      • »
        »
        »
        »
        4 года назад, скрыть # ^ |
         
        Проголосовать: нравится 0 Проголосовать: не нравится

        Nice idea lol

        • »
          »
          »
          »
          »
          4 года назад, скрыть # ^ |
           
          Проголосовать: нравится 0 Проголосовать: не нравится

          Well, I just wanted to save time instead of inventing some original solution for this particular problem (and then proving that it correctly handles all corner cases). I'm not a particularly fast problem solver and taking care of A+B+C took me 13 minutes. Without segment tree this time could be even worse.

          Your solution uses sort and you have beaten me by solving A+B+C in only 5 minutes. But now imagine not having sort function in the standard library. In this case you would need to find some decent bug free $$$O(N log N)$$$ sort implementation and copy/paste it as a part of your solution. Implementing your own sort from scratch during the contest would be a fool's errand and waste of time. Segment tree is pretty much the same and the only difference is that it is typically not provided in standard libraries of programming languages, so I need to copy/paste the atcoder's implementation.

          My $$$O(N log N)$$$ segment tree solution implemented in D language can be even tweaked to remove all loops and branches 182184534 (except for the main loop iterating over testcases) and this reduces cyclomatic complexity. For comparison, a faster Wanderkind's $$$O(N)$$$ solution 182072909 also implemented in D language is more complicated. But both are fast enough and coding speed/convenience is IMHO more important during a contest.

          • »
            »
            »
            »
            »
            »
            4 года назад, скрыть # ^ |
             
            Проголосовать: нравится 0 Проголосовать: не нравится

            I agree with you on that. But most programming languages already have sort function. I personally read the problem quickly and the sample explanations and coded it. I know that I can't solve a lot of problems so I depend on speed instead. The problem doesn't really need proving but if you're looking for special cases and a full proven solution then yes Segment Tree was much better

          • »
            »
            »
            »
            »
            »
            4 года назад, скрыть # ^ |
             
            Проголосовать: нравится 0 Проголосовать: не нравится

            Is there a reason you didn't use the sort function in std.algorithm?

            I didn't because I am new to this language and I am not yet familiar with handling arrays.

            • »
              »
              »
              »
              »
              »
              »
              4 года назад, скрыть # ^ |
               
              Проголосовать: нравится 0 Проголосовать: не нравится

              Because segment tree just happened to be my first idea after reading the problem statement. But I used sort for solving problems A and F.

          • »
            »
            »
            »
            »
            »
            4 года назад, скрыть # ^ |
             
            Проголосовать: нравится 0 Проголосовать: не нравится

            I imagine not having sort and finding first and second maximums

            • »
              »
              »
              »
              »
              »
              »
              4 года назад, скрыть # ^ |
               
              Проголосовать: нравится 0 Проголосовать: не нравится

              This was exactly the point of my comment. Both sort and segment tree are not necessary for solving this problem. They both actually degrade time complexity. But they both are also easy to use and save time (tourist used sort 181903982 and the editorial suggests sort too). Sort is included in the standard library, while segment tree has to be copy/pasted.

»
4 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

For E, missed test case 7, just changed int to long after the contest, it got passed.

»
4 года назад, скрыть # |
 
Проголосовать: нравится +22 Проголосовать: не нравится

My solutions (video):

A. Medium Number

Solution

B. Atilla's Favorite Problem

Solution

C. Advantage

Solution

D. Challenging Valleys

Solution

E. Binary Inversions

Solution

F. Quests

Solution

G. SlavicG's Favorite Problem

Solution
»
4 года назад, скрыть # |
 
Проголосовать: нравится +2 Проголосовать: не нравится

problem G: Your task is to go from vertex a to vertex b, but you are allowed to enter node b if and only if after traveling to it, the value of x will become 0.

Why use "enter" instead of "arrive at" explaining the statement? I misunderstood when solving this problem and wasted 1 hour!

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

What does ios::sync_with_stdio(0); cin.tie(0); these 2 lines mean?

»
4 года назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

is there any source apart from codeforces so that people from India and China communicate?

»
4 года назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

Can someone give a test case for which my code for D is failing?
https://codeforces.me/contest/1760/submission/182044338

»
4 года назад, скрыть # |
← Rev. 3  
Проголосовать: нравится 0 Проголосовать: не нравится

History repeats itself. Four hacking attempts (all are of the same submission) are now stuck either in "Waiting" or "In queue" state. MikeMirzayanov, can we do something about this?

UPD: still in queue after the final testing. Déjà vu...

»
4 года назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

BTW what's a counterexample for binary inversions if I only flip either the first 0 bit, last 1 bit, or none?

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Hi everybody! How can i register for the competition?

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

why the rating is not increasing? I wanna see myself cyan

»
4 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

What is the difficulty of problems in this contest ??? I don't see any tag.

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

@Down Though my rating less than 1400 in whole codeforces rating history and I have given more than 5 contests still my rating has not been increased after securing 2000 rank.

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

For the G Question it is giving me wrong answer on test case 2 . Whats wrong in this code . I am first storing the xor of path till all the node from a and b as root respectively , Then checking for common elements . https://codeforces.me/contest/1760/submission/182136945

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Have the ratings updated ?

»
4 года назад, скрыть # |
 
Проголосовать: нравится +4 Проголосовать: не нравится

qwexd I have given 7 contest in which I have solve more than 1 problems in almost all..Can you please check why my rating is not increasing.I am grey rated which means I have rating less than 1400.

  • »
    »
    4 года назад, скрыть # ^ |
     
    Проголосовать: нравится +1 Проголосовать: не нравится

    Assuming you have no competitive programming exp prior to coming to codeforces. Solving 1 problem in div 2 rounds places u somewhere between 9k-12k in rank, for getting a better rating, you need to have a better rank, for getting better rank you have to solve around 3-4 problems depending on round difficulty, A and B are generally ad-hoc/implementation type. However, from C you need to practice problems of specific tags.

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I solved the same problems with another account because the other one made a lot of stupid mistakes, but the rating didn't increased.

can you please accept it from this account and ignore the other

»
4 года назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

Please Codeforces send Me a message said that "Your solution 181995500 for the problem 1760F significantly coincides with solutions Morad/181995500, Hussam-alwan/182013671, Rakhimov_Ans/182023461 If you have conclusive evidence that a coincidence has occurred due to the use of a common source published before the competition, write a comment to post about the round with all the details. " and skipped all My Solutions And I Have not Any conclusive evidence But Only i submitted My Solution on 18:58 and anthor Person submitted on 19:26 So I Haven't an account on Idone and didn't Use it and I should Be a Specialist in this Contest !!!! please Help Me! Thanks For Your Time

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

In the last div 4, my solution for the problem E Binary Inversions link to problemgot skipped due to the similarity of code from the user merahijalwa/181973274. first of all I don't know him and the similarity in code is due to code available in the geeks for geeks platform for counting the number of inversions in the array link to code from geeks for geeks website .
please consider this as this is a legit case and this is fist time i am going to reach pupil rank. please MikeMirzayanov consider this case as my case is completely legit and nor i have use any online ides. If anyone know how to contact codeforces team..please comment.

»
4 года назад, скрыть # |
← Rev. 3  
Проголосовать: нравится 0 Проголосовать: не нравится

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Ah screw my luck. I'm 1399 now

»
4 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Why am I not rated for div4

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Nice Contest, Quality problemset and Good tutorial!! Kudos to the CF team & contest team

»
4 года назад, скрыть # |
 
Проголосовать: нравится -9 Проголосовать: не нравится

I didn't share my code to ANYONE!!!!!!! What will happen if someone locked and try to hack me,and share my code to other? YOU HAVE WRONGED ME

»
4 года назад, скрыть # |
 
Проголосовать: нравится -8 Проголосовать: не нравится

ю орн срунц

»
4 года назад, скрыть # |
 
Проголосовать: нравится +15 Проголосовать: не нравится

:sadge:

»
4 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится -27 Проголосовать: не нравится

This is a BAD round. Problems aren't FUN at all. They are too STANDARD and ROUTINIZED. PLEASE refrain from setting such rounds from now on.

UPD: PLEASE don't downvote me! I am just saying my opinion.

»
4 года назад, скрыть # |
 
Проголосовать: нравится -8 Проголосовать: не нравится

Why my rating is not updated . yesterday i saw it was there but now its gone :(

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

What means "If k can be arbitrarily large, output Infinity" in the problem F?

  • »
    »
    4 года назад, скрыть # ^ |
    ← Rev. 2  
    Проголосовать: нравится 0 Проголосовать: не нравится

    idk if this answer your question but: If for every $$$k$$$ that i choose that is a solution, i can choose a bigger number $$$l$$$ that also is a solution, that means that $$$k$$$ is arbitrarily large.

    For example, see this input:

    2 20 10

    100 10

    The output is infinity, because it doesn't matter how big i take $$$k$$$ to be, because in the first day i can just take the first quest, gains 100 coins, and have more that 20 coins.