i keep getting WA on test 5. can someone help?

https://mirror.codeforces.com/contest/4/submission/247821660

thanks!

# | User | Rating |
---|---|---|

1 | tourist | 3690 |

2 | jiangly | 3647 |

3 | Benq | 3581 |

4 | orzdevinwang | 3570 |

5 | Geothermal | 3569 |

5 | cnnfls_csy | 3569 |

7 | Radewoosh | 3509 |

8 | ecnerwala | 3486 |

9 | jqdai0815 | 3474 |

10 | gyh20 | 3447 |

# | User | Contrib. |
---|---|---|

1 | maomao90 | 173 |

2 | awoo | 164 |

3 | adamant | 163 |

4 | TheScrasse | 159 |

5 | nor | 157 |

6 | maroonrk | 156 |

7 | -is-this-fft- | 152 |

8 | Petr | 146 |

8 | orz | 146 |

10 | pajenegod | 145 |

i keep getting WA on test 5. can someone help?

https://mirror.codeforces.com/contest/4/submission/247821660

thanks!

Codeforces | In English По-русски pathetique | Logout

HOMETOPCATALOGCONTESTSGYMPROBLEMSETGROUPSRATINGEDUAPICALENDARHELP

→ Pay attention Before contest Educational Codeforces Round 162 (Rated for Div. 2) 2 days Register now » → pathetique

pathetique User''s contest rating in Codeforces communityRating: 1448 User''s contribution into Codeforces communityContribution: -61 Settings Blog Favourites Teams Submissions Problemsetting Groups Talks Contests

→ Top rated

1 jiangly 3678 2 Benq 3602 3 ecnerwala 3542 4 maroonrk 3541 5 cnnfls_csy 3540 6 orzdevinwang 3493 7 inaFSTream 3478 8 Um_nik 3430 9 Geothermal 3409 9 Rebelz 3409 Countries | Cities | Organizations View all → → Top contributors

1 maomao90 174 2 adamant 164 3 TheScrasse 161 3 SecondThread 161 3 awoo 161 6 nor 159 7 maroonrk 158 8 Um_nik 156 9 BledDest 145 9 Geothermal 145 View all → → Favourite groups

1 X-Camp 402H 2022 Fall View all → → Find user Handle: → Recent actions Geothermal → I'm Geothermal. AMA! New comment(s) flamestorm → Codeforces Round 928 (Div. 4) New comment(s) optimize_ofast → My tutorial of "Codeforces Round 928 (Div. 4) A.Vlad and the Best of Five" New comment(s) Cat.Noir → How i can solve this problem, Lucky Number New comment(s) mesanu → Codeforces Round 928 (Div. 4) Editorial New comment(s) espnINF → I became specialist!!! New comment(s) ishat_jha → Beginner Contest [R800-R1000] Problems Text created or updated oursaco → HPI 2024 Registration Open! [3/9/2024, $1000+ PRIZES, In-person/Online Mirror] New comment(s) Imtiaz.axi → Long long division. New comment(s) ishat_jha → Beginner Contest [R800-R1000] Editorial New comment(s) pashka → Codeforces Round 927 (Div. 3) New comment(s) BucketPotato → Bay Area Programming Contest 2024 Text created or updated PagalavanPagal66 → I become Expert....! New comment(s) satyam343 → think-cell Round 1 New comment(s) propanol → My first blog post New comment(s) Necropost macaquedev → Cheating New comment(s) Cpp_Writer → My opinions about cheating New comment(s) nkq18072008 → Can someone helps me? Text created or updated nikgaevoy → Push-Free Segment Tree New comment(s) Necropost p_safronov → Burnout in competitive programming Text created or updated satyam343 → think-cell Round 1 Editorial New comment(s) -010 → LIS O(NlogN) Text created or updated FairyWinx → Codeforces Round #926 (Div. 2) Editorial. New comment(s) MN3M → Trailer..... Text created or updated DecayingSylow → Maybe I got why Chinese contestants are so strong New comment(s) Detailed → Codeforces Round 928 (Div. 4)

By flamestorm, 3 days ago, In English mesanu, SlavicG and I are very excited to invite you to Codeforces Round 928 (Div. 4)! It starts on Monday, February 19, 2024 at 06:35UTC-8. We would also like to give a very special thanks to the efforts of MikeMirzayanov and Vladosiya, who helped significantly with the preparation of the round!

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.

Thanks a lot to the testers: MADE_IN_HEAVEN, Gheal, Dominater069, Phantom_Performer, Vladosiya, htetgm, hbarp, tvladm!

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

UPD: Editorial is posted!

Full text and comments »

Announcement of Codeforces Round 928 (Div. 4) Tags div4 Vote: I like it+168Vote: I do not like it Author flamestormPublication date 3 days agoComments 271 Codeforces Round 927 (Div. 3)

By pashka, history, 3 days ago, In English Hello! On Sunday, February 18, 2024 at 04:05UTC-8 will start Codeforces Round 927 (Div. 3), the next Codeforces round for the third division.

The round is based on problems from JetBrains Academy Youth Challenge. If you participated in it, please don't participate in this round.

Problems for this round are prepared by denk, step_by_step, goncharovmike, ikrpprppp, pashka, Vladosiya and MikeMirzayanov.

Thank you very much awoo, BledDest, buyolitsez, EgorUlin, Gojova, GrandFruit, Hello_zoka, petyb, scanhex, senjougaharin, shnirelman, SomethingNew, Toy_mouse, Zandler for testing the round.

As usual for the third division rounds:

there will be 6-8 tasks in a round round duration is 2 hours 15 minutes the round follows the ICPC rules, penalty for an incorrect submission is 10 minutes round is rated for participants with ratings up to 1600 after the round there will be a 12-hour open hacking phase Remember that only the trusted participants of the third division will be included in the official standings table. As it is written by link, this is a compulsory measure for combating unsporting behaviour. To qualify as a trusted participant of the third 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 1900 or higher in the rating. Regardless of whether you are a trusted participant of the third division or not, if your rating is less than 1600, then the round will be rated for you.

Good luck to all!

Full text and comments »

Announcement of Codeforces Round 927 (Div. 3) Vote: I like it+175Vote: I do not like it Author pashkaPublication date 3 days agoComments 287 think-cell Round 1

By satyam343, 8 days ago, In English Hello, Codeforces!

Welcome to the think-cell Round 1 supported by think-cell, which will start on Saturday, February 17, 2024 at 06:35UTC-8. It will be a combined rated round for both divisions. All problems were authored and prepared by Elegia and satyam343.

We would like to thank:

errorgorn for round coordination and help with preparation KAN for helping with the preparation of problems Alexdat2000 for Russian translation GoatTamer and Non-origination for discussing problems with us while our proposal was in review and testing the round. Kaitokid, antekb, vgtcross, riano_, mtw, AboAbdoMC, Vladithur, BERNARD, milind0110, conqueror_of_tourist, Um_nik, gamegame, htetgm, brobat, LucaLucaM, the_hyp0cr1t3, tibinyte, 18o3, ExpensiveAC, MateiKing80, udhavvarma03, Non-origination, RDDCCD, Kuroni, Brovko, LipArcanjo, andrei_boaca, nok0, oursaco, ffao, prvocislo, SmolBrain, dario2994, brunovsky, tabr, PurpleCrayon, IceKnight1093, aryanc403 and Golovanov399 for testing the round MikeMirzayanov for great systems Codeforces and Polygon. You will be given 9 problems and 3 hours to solve them. One of the problems will be divided into two subtasks. One of the problems will be interactive. Make sure to read this blog and familiarize yourself with these types of problems before the round!

We hope you'll like the problemset!

UPD 1 : The score distribution is 500−1000−1500−(1250+1000)−2500−2750−3500−3500−5000 .

Congratulations to the winners!

cnnfls_csy

Geothermal

Benq

gyh20

Ormlis

jiangly

tourist

ksun48

Petr

maroonrk

Congratulations to the first solves as well!

A : SSerxhs

B : SSerxhs

C : M_A

D1 : hitonanode

D2 : hitonanode

E : ksun48

F : MAOooOAM

G : gyh20

H : maroonrk

I : Kapt [upsolved]

UPD 2: Editorial is out.

And now a word from our round partner – think-cell:

text

think-cell is the leading data visualization software for business presentations. Our mission is to offer the most intuitive user interface for generating complex data-driven charts and slides, while at the same time ensuring seamless integration with Microsoft Office. We work on challenging visualization problems, reverse-engineer Microsoft’s code, and reinvent how slides are created. think-cell is the only German company funding the C++ ISO committee delegation, so there is a good chance that components we invent will find their way into the standard.

Right now, we are looking for smart, creative C++ engineers with a solid theoretical background to join our engineering team.

Highlights of the role:

We use the latest C++ features as soon as the compilers support them. We’re not afraid of advanced template metaprogramming or macros when they avoid code duplication or lead to cleaner, more readable code. We prefer algorithms and ranges (esp. ours!) over raw loops. We take the time to deliver perfect code. We love refactoring and modernizing old code and introducing our own libraries. If we can do better than the standard library, we write our own! If we have done something cool, we talk about it at C++ conferences. If we are missing a C++ language feature, we write a proposal and present it to the C++ standard committee. Here is what we offer:

A competitive salary from the start and a raise to EUR 130,000 annually after only one year. Full support with relocation to Berlin or the option to work fully remotely. An apartment for the first month if relocating to Berlin. Lifestyle-friendly working hours, no deadlines, no overtime. No scheduled meetings. An international team of brilliant minds. A flat organisation with respectful colleagues and plenty of room for your ideas. A working environment that is driven by the strive for excellence. text

Already convinced?

Apply Learn more P.S. don't forget to check out our developer blog to learn more about our commitment to the tech world!

Join think-cell Round 1 that will start on Saturday, February 17, 2024 at 06:35UTC-8 for a chance to challenge your skills among other developers and win the following prizes.

- First place: Apple iPad Air (10.9-inch iPad Air Wi-Fi 256GB),
- Second and Third place: Apple Watch (Apple Watch Series 9 GPS + Cellular, 41mm Aluminum Case with Solo Loop),
- 4-50 places: think-cell branded socks
- 200 additional socks will be distributed randomly among the rest of the participants who solved at least one problem and for whom this is not the first rated round!

Full text and comments »

Announcement of think-cell Round 1 Vote: I like it+765Vote: I do not like it Author satyam343Publication date 8 days agoComments 275 Codeforces Round #926 (Div. 2)

By FairyWinx, 7 days ago, translation, In English Neko Nya, Кодефорсес =＾● ⋏ ●＾= I'm happy to invite you to participate in Codeforces Round 926 (Div. 2). It will take place on Thursday, February 15, 2024 at 06:35UTC-8 and in it, you will help a boy named Sasha win over a girl's heart. The round will be rated for all participants with a rating strictly less than 2100. You will have 2 hours to solve 6 problems.

Here is a big thank you to everyone involved in the round:

The cutest coordinator Artyom123. (No offense to the others) KAN, geranazavr555, MikeMirzayanov for the BEST platform. Legion of testers: A_G, AgafonovArtem, Alexdat2000, Vladithur, wuhudsm, petyb, induk_v_tsiane, sevlll777, mz1, SomethingNew, AVdovin, NewLul, damirsit, skylak3_3, Andreasyan. Also to this wonderful person for his invaluable contribution to the round teraqqq. Looking forward to seeing everyone at the contest >~<

UPD: Scoring distribution: 500 — 1000 — 1500 — 2000 — 2500 — 3000

UPD2: Editorial

Full text and comments »

Announcement of Codeforces Round 926 (Div. 2) Vote: I like it+679Vote: I do not like it Author FairyWinxPublication date 7 days agoComments 351 "Adolescent Grigore Moisil" (AGM) International Programming Contest 2024

By george_stelian, history, 7 days ago, In English Dear Codeforces,

I am honored to share that the X-th edition of the AGM International Programming Contest has officially begun!

AGM is addressed to High School students who compete in teams of up to 3 members, ICPC-style. The contest has 2 rounds:

The Qualification Round held online, on Saturday, the 23rd of March 2024 between 14:00 and 19:00 GMT+2 (timeanddate) The Final Round held onsite in Bucharest. The date and time will be announced soon. Registrations are opened until the 15th of March at 17:00 GMT+2: https://forms.gle/WbS4zjsJhBaXmjYHA

The problem sets are entirely developed by current and former university students from the United Kingdom and Romania.

The top 10 teams of the Final Round will receive Diplomas. Additionally, the top 3 teams of the Final Round will receive cash prizes:

I-st place: 1200 RON II-nd place: 900 RON III-rd place: 600 RON In the meantime, please have a look over the last four years' problem sets here.

Here are some useful links:

Website: https://agm-contest.com Facebook: @AGM.Contest Competition Rules: https://agm-contest.com/competition-rules E-mail address: contact@agm-contest.com Finally, I am more than delighted to present our team: patrick.sava (the heart of the project), teoionescu, carabet.cosmin, Mihai22e, Stelutzu, munteanuvlad98, caesar2001, average_frog_enjoyer, popovicirobert, Alex18mai, ionan6ix, butasebi, Stefan_Radu, eman98, mihaicristian, yodoli27, cristb, venom1724, zarg169 and me

We are looking forward to welcoming everyone!

Kind regards,

George

Full text and comments »

Tags contest, icpc, high school Vote: I like it+75Vote: I do not like it Author george_stelianPublication date 7 days agoComments 4 Codeforces Round #925 (Div. 3)

By Vladosiya, history, 9 days ago, translation, In English Hello! Codeforces Round 925 (Div. 3) will start at Tuesday, February 13, 2024 at 06:35UTC-8. You will be offered 6-8 problems with expected difficulties to compose an interesting competition for participants with ratings up to 1600. However, all of you who wish to take part and have a rating of 1600 or higher, can register for the round unofficially.

The round will be hosted by rules of educational rounds (extended ICPC). Thus, solutions will be judged on preliminary tests during the round, and after the round, it will be a 12-hour phase of open hacks.

You will be given 7 problems and 2 hours and 15 minutes to solve them.

Note that the penalty for the wrong submission in this round is 10 minutes.

Remember that only the trusted participants of the third division will be included in the official standings table. As it is written by link, this is a compulsory measure for combating unsporting behavior. To qualify as a trusted participant of the third 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 1900 or higher in the rating. Regardless of whether you are a trusted participant of the third division or not, if your rating is less than 1600, then the round will be rated for you.

Problems have been created and written by our team: myav, Gornak40, senjougaharin and Vladosiya.

We would like to thank:

MikeMirzayanov for help with ideas and Polygon and Codeforces platforms.

nigus for red testing.

vladmart, Gheal, KseniaShk for yellow testing.

htetgm for purple testing.

natalina, SashaT9, lockdown, bma20006 for blue testing.

RedDreams for cyan testing.

the_Incharge, Aurora__, Longqiang for green testing

Good luck!

P.S. Happy Valentine's Day!

UPD: Let's continue streak of announces with photo of the authors :)

UPD2: Editorial

Full text and comments »

Announcement of Codeforces Round 925 (Div. 3) Vote: I like it+385Vote: I do not like it Author VladosiyaPublication date 9 days agoComments 247 Codeforces Round 924 (Div. 2)

By Artyom123, history, 12 days ago, In English Hello, Codeforces! We're glad to invite you to take part in Codeforces Round 924 (Div. 2), which will start on Sunday, February 11, 2024 at 01:35UTC-8. You will be given 6 problems and 2 hours to solve them.

This round will be rated for participants whose rating is below 2100. Participants with higher rating can participate unofficially.

The problems were authored and prepared by vaaven, silvvasil, Alexdat2000, teraqqq and me.

The round is based on Moscow Olympiad for school students.

We would like to thank

TheScrasse for his high-speed coordination; nor, Wizard_of_Orz, GreatEagle, rolandpetrean, volochai, A_G, Wobert, --tofu--, -is-this-fft-, jamesbamber, franv, MatteoArcari, sum, rayban, Be11T_, sashastrakhal, ihavenoenemies and cowgirl for testing; MikeMirzayanov for creating Codeforces and Polygon. Score distribution: 500−1000−1500−1750−2250−2750 UPD: Editorial

UPD2: Congratulations to the winners!

Div. 2

hmmmmm

satellite.

RomkaRS

Alx

hirayuu_cf

Div. 1

SSRS_

maspy

kotatsugame

74TrAkToR

SSerxhs

Full text and comments »

Announcement of Codeforces Round 924 (Div. 2) Vote: I like it+504Vote: I do not like it Author Artyom123Publication date 12 days agoComments 261 Codeforces Round 923 (Div. 3)

By MikeMirzayanov, 2 weeks ago, In English Gamarjoba, Codeforces!

On Tuesday, February 6, 2024 at 06:45UTC-8 will start Codeforces Round 923 (Div. 3), the next Codeforces round for the Div.3.

Lately, I've been coming up with problem ideas less frequently, but I don't want to lose this skill. Welcome to the round where all problems are my own creation! I hope you'll enjoy them.

A huge thank you to Vladosiya for preparing the majority of problems in Polygon. Also, thanks to pashka and KAN for helping with the discussion of problem ideas.

Thank you very much 74TrAkToR, CLown1331, EternalAlexander, Jostic11, Killever, KoT_OsKaR, LoveWX, MADE_IN_HEAVEN, dan_dolmatov, jnmtz111__, pedrolino, theRealChainman, yorky for testing the round.

As usual for the Div.3 rounds:

There will be 6-8 tasks in a round. The round duration is 2 hours and 15 minutes. The round follows the ICPC rules, with a penalty for an incorrect submission being 10 minutes. The round is rated for participants with ratings up to 1600. After the round, there will be a 12-hour open hacking phase. Remember that only the trusted participants of the Div.3 will be included in the official standings table. As it is written in the link, this is a compulsory measure to combat unsporting behavior. To qualify as a trusted participant of the third division, you must:

Participate in at least five rated rounds (and solve at least one problem in each of them). Not have a rating of 1900 or higher. Regardless of whether you are a trusted participant of the third division or not, if your rating is less than 1600, then the round will be rated for you.

Good luck to all!

I really like it when the round announcement includes a photo of the authors. I plan to add one if I can take a suitable photo.

UPD 1: I found great burgers in Tbilisi!

UPD 2: The editorial is published: https://mirror.codeforces.com/blog/entry/125597 (thank you, Vladosiya).

Full text and comments »

Announcement of Codeforces Round 923 (Div. 3) Tags div3, 923 Vote: I like it+1435Vote: I do not like it Author MikeMirzayanovPublication date 2 weeks agoComments 367 Codeforces: Results of 2023 [Annual Report]

By MikeMirzayanov, 2 weeks ago, In English Hello, Codeforces.

Let's recall 2023, shall we?

In this post, I want to summarize this year. You know, a lot of terrible things happen in the world, and personally, this year was the hardest and most sorrowful for me. But today, we'll remember something else. We'll remember what this year was like for Codeforces.

Recently, Codeforces turned 14 years old. Not bad, right? And for many years now, when asked "What is Codeforces?" the first thing I say is — it's a community!

Full text and comments »

Tags codeforces, report, 2023 Vote: I like it+1735Vote: I do not like it Author MikeMirzayanovPublication date 2 weeks agoComments 63 ← 1 2 3 ... 227 228 →

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov The only programming contests Web 2.0 platform Server time: Feb/20/2024 20:58:23UTC-8 (h1). Desktop version, switch to mobile version. Privacy Policy Supported by TON ИТМО

struct Node { int key; Node* left; Node* right; Node* parent; // Added parent pointer for easier traversal Node(int k, Node* p = nullptr) : key(k), left(nullptr), right(nullptr), parent(p) {} };

Node* createNode(int key, Node* parent = nullptr) { return new Node(key, parent); }

Node* rightRotate(Node* x) { Node* y = x->left; x->left = y->right; if (y->right) y->right->parent = x; y->right = x; y->parent = x->parent; x->parent = y; return y; }

Node* leftRotate(Node* x) { Node* y = x->right; x->right = y->left; if (y->left) y->left->parent = x; y->left = x; y->parent = x->parent; x->parent = y; return y; }

Node* splay(Node* root, int key) { if (root == nullptr || root->key == key) return root;

if (root->key > key) { if (root->left == nullptr) return root; if (root->left->key > key) { root->left->left = splay(root->left->left, key); root = rightRotate(root); } else if (root->left->key < key) { root->left->right = splay(root->left->right, key); if (root->left->right != nullptr) root->left = leftRotate(root->left); } return (root->left == nullptr) ? root : rightRotate(root); } else { if (root->right == nullptr) return root; if (root->right->key > key) { root->right->left = splay(root->right->left, key); if (root->right->left != nullptr) root->right = rightRotate(root->right); } else if (root->right->key < key) { root->right->right = splay(root->right->right, key); root = leftRotate(root); } return (root->right == nullptr) ? root : leftRotate(root); }

}

Node* insert(Node* root, int key) { if (root == nullptr) return createNode(key);

root = splay(root, key); if (root->key == key) return root; Node* newNode = createNode(key); if (root->key > key) { newNode->right = root; newNode->left = root->left; if (root->left) root->left->parent = newNode; root->left = nullptr; } else { newNode->left = root; newNode->right = root->right; if (root->right) root->right->parent = newNode; root->right = nullptr; } newNode->parent = nullptr; // New root has no parent return newNode;

}

void inOrder(Node* root) { if (root) { inOrder(root->left); std::cout << root->key << " "; inOrder(root->right); } }

int main() { Node* root = nullptr;

root = insert(root, 10); root = insert(root, 20); root = insert(root, 30); root = insert(root, 40); root = insert(root, 50); std::cout << "Inorder traversal of the splay tree: "; inOrder(root); std::cout << std::endl; return 0;

}

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: May/20/2024 09:17:21 (i1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|