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

Автор pathetique, история, 2 недели назад, По-английски

On November 10, 2024, shsh became master. ORZ!

Полный текст и комментарии »

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

Автор pathetique, история, 3 месяца назад, По-английски

i've sovled a few 1600 problems. shouldn't the system give me 1600 rating?

i think i've been scammed

can someone fix this? codeforces please help me

Полный текст и комментарии »

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

Автор pathetique, история, 3 месяца назад, По-английски

Other than never giving up(on problem C), when it comes to greedy solutions, if you can't completely prove a greedy solution to be correct, it never hurts to re-enforce your solution by taking the max/min(if necessary) between all the cases.

This important lesson cost me over 200-250 extra in-contest points which is also roughly 20ish p-delta.

(It might've also cost me a solve on problem D, but I'm not sure... I never took the chance to look.)

Полный текст и комментарии »

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

Автор pathetique, история, 4 месяца назад, По-английски

As a programmer, there have been countless times when I felt like giving up during my contest practice days. The frustration of not solving a problem or facing unexpected challenges can sometimes be overwhelming. During these tough moments, I found solace and strength in simple yet powerful motivational quotes.

These quotes were not just words; they were a source of energy that kept me going, pushing me to strive harder and not give up. Here are a few quotes that have profoundly impacted me:


// Source: https://usaco.guide/general/io #include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while(t--){ int n; cin >> n; string s; cin >> s; map<char,int> cnt; for(int i = 0;i < s.length();i++){ cnt[s[i]]++; } cout << min(n,cnt['A'])+min(n,cnt['B'])+min(n,cnt['C'])+min(n,cnt['D']) << endl; } }

Also, here is another good one:

#include <bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
const ll mod = 1e9 + 7;
// cope counter = 2254
 
signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t;
	cin >> t;
	while(t--) {
		int n, k;
		cin >> n >> k;
		int ans = 0, bk = 0;
		while(k > 0) {
			k -= n, ans++, bk ^= 1;
			if(bk) n--;
		}
		cout << ans << "\n";
	}
}

Insert_Username_Here

These quotes reminded me that every challenge is an opportunity to learn and grow. They helped me stay focused, keep pushing through difficult times, and eventually achieve success in my coding journey.

If you're looking for more motivational quotes to keep you inspired, I've compiled a collection on my website Inspiring Quotes You'll find not only motivational quotes but also quotes on various other topics that might resonate with you during your coding practice or any other challenges you face.

Remember, it's the small things, like a few words of encouragement, that can make a big difference. Keep coding, keep pushing, and most importantly, never give up!

Полный текст и комментарии »

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

Автор pathetique, история, 4 месяца назад, По-английски
  • Проголосовать: нравится
  • -51
  • Проголосовать: не нравится

Автор pathetique, история, 4 месяца назад, По-английски

just got this message, idk what it means someone help

Hello, pathetique! Your recent comments/blog posts/other activities have violated rules of our community. It seems this content is nonsensical, troll-like, dirty, coarse, offensive, aggressive, meaningless, violating other rules or ethical norms. Probably, it wasn’t written in English (or Russian if you specify this language for blog post or comment). Please, be polite, reasoned, do not publish junk content, do not violate conventional ethical standards. You should not publish content that does not correspond to the topic of discussion or does not correspond to the topic of the website. Use common sense when analyzing to write or not write any content. You should not publish comic content, especially if it is not interesting to a wide part of the audience, repeats the existing one, or has no connection with competitive programming. Your account has been blocked to write any social content for 48 hours and your recent content has been deleted. Hope you follow the relevant conclusions and this situation will not happen again. In case of repeated violations, more severe penalties may be applied to your account, up to and including blocking.

Полный текст и комментарии »

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

Автор pathetique, история, 4 месяца назад, По-английски
  1. contribution
  2. contribution
  3. contribution
  4. contribution
  5. newbies

Полный текст и комментарии »

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

Автор pathetique, история, 6 месяцев назад, По-английски

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

HOMETOPCATALOGCONTESTSGYMPROBLEMSETGROUPSRATINGEDUAPICALENDARHELP

→ Pay attention Before contest Codeforces Global Round 26 3 days Register now » *has extra registration → pathetique

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

→ Top rated

User Rating

1 tourist 3757 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 Countries | Cities | Organizations View all → → Top contributors

User Contrib.

1 maomao90 171 2 awoo 164 3 adamant 163 4 TheScrasse 159 5 maroonrk 155 6 nor 154 7 -is-this-fft- 152 8 Petr 147 9 orz 145 10 pajenegod 144 View all → → Favourite groups

Name

1 X-Camp 402H 2022 Fall View all → → Find user Handle: → Recent actions Vladosiya → Codeforces Round 950 (Div. 3) New comment(s) iNNNo → Codeforces Round 951 (Div. 2) Editorial New comment(s) dorjderem → Anyone who comments under this post has to reach CM by September if can't.... New comment(s) mesanu → Codeforces Round #898 (Div. 4) Editorial New comment(s) adamjamil → Jobs for competitive programmers: Reflection New comment(s) Necropost Vladosiya → Codeforces Round 950 (Div. 3) Editorial New comment(s) iNNNo → Codeforces Round 951 (Div. 2) New comment(s) vovuh → Codeforces Round #544 (Div. 3) Editorial New comment(s) Necropost stefdasca → Click here if you want to know your future CF rating [Part 2] New comment(s) FedeNQ → Teams going to ICPC WF 2024 (Kazakhstan 2024) — WIP List Text created or updated amin_2008 → EGOI 2024 Teams Text created or updated Um_nik → How to read problem statements New comment(s) Necropost zltzlt → Codeforces Round 949 (Div. 2) New comment(s) MikeMirzayanov → Rule about third-party code is changing New comment(s) Necropost flamestorm → Codeforces Round #799 (Div. 4) Editorial Text created or updated Necropost UshanGhosh → Invitation to the Replay of ShellBeeHaken Presents Intra SUST Programming Contest 2024 New comment(s) jainnirav88 → Keep Problems — Browser Extension | Keep track of coding problems New comment(s) Necropost nubskr → I implemented codeforces from scratch New comment(s) Stefan2417 → Codeforces Round #948 (Div. 2) Editorial New comment(s) Kuroni → Codeforces Global Round 25 New comment(s) zltzlt → Codeforces Round 949 (Div. 2) Editorial New comment(s) tourist → Code Weekend #1 New comment(s) IceKnight1093 → Invitation to CodeChef Starters 137(Rated till 5-Stars) — 5th June New comment(s) ICPCNews → The 2023 Post World Finals Online ICPC Challenge powered by Huawei New comment(s) rek → Codeforces Round #456 (Div. 2) Editorial New comment(s) Necropost Detailed → Codeforces Round 951 (Div. 2)

By iNNNo, history, 37 hours ago, In English Hello, Codeforces! I am glad to invite you to participate in Codeforces Round 951 (Div. 2), which will take place at Thursday, June 6, 2024 at 10:35UTC-4.

This round will be rated for participants with a rating below 2100. Participants with a higher rating can take part out of competition.

You will be offered 6 problems and 2 hours to solve them! Interactive tasks may occur in the round. Please read this blog to get familiar with this type of problems.

All tasks are authored and prepared by me. However, I'd like to thank Greg908 for discussing ideas about problems and useful feedback!

I would like to thank:

Artyom123 for his amazing coordination!

74TrAkToR for the initial help with this round.

isaf27 for LGM testing.

dorijanlendvaj, A_G, Mangooste, andrei_boaca and BucketPotato for red testing.

ArtAlex, salyg1n, Kihihihi, 127.0.0.1, max0000561, ilyakrasnovv and a.nasretdinov for orange testing.

Semen07 for purple testing.

newb_programmer for blue testing.

A1st for cyan testing.

ishaandas1 for green testing.

TimoSvyato and HatakeyamaLeo for grey testing.

MikeMirzayanov and the entire Codeforces team for creating the wonderful platforms Codeforces and Polygon.

The goal was to create problems interesting to solve. Hope you'll enjoy them all!

Score distribution: 500−1000−1500−2000−2500−3000 ;

Good luck!

UPD: Congratulations to the winners!

Div. 2:

Tanikaze_Amane

olmrgcsi

PMPuns

MegalovaniaJ

Sylphrena

Div. 1 + Div 2:

turmax

jiangly

kotatsugame

peti1234

BurnedChicken

Editorial is out!

Full text and comments »

Announcement of Codeforces Round 951 (Div. 2) Vote: I like it+171Vote: I do not like it Author iNNNoPublication date 37 hours agoComments 242 Codeforces Round 950 (Div. 3)

By Vladosiya, history, 6 days ago, translation, In English Hello! Codeforces Round 950 (Div. 3) will start at Monday, June 3, 2024 at 10:35UTC-4. 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. After open hacks all accepted solutions will be rejudged on successful hacks.

You will be given 6-8 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.

Be_dos, Dominater069, 74TrAkToR, BucketPotato for red testing.

KseniaShk, cry, tolbi, ScarletS, nskybytskyi, sevlll777 for yellow testing.

mahdi.hasnat, Phantom_Performer, mainyutin for purple testing.

natalina, FBI, Kopite, MADE_IN_HEAVEN, mz1 for blue testing.

Romakolesn for cyan testing.

Good luck!

P.S.: We are aware of the error that occurred while updating the ratings for Educational Codeforces Round 166. It will be fixed before this round. UPD: We fixed it!

UPD: Editorial is out!

Full text and comments »

Announcement of Codeforces Round 950 (Div. 3) Vote: I like it+196Vote: I do not like it Author VladosiyaPublication date 6 days agoComments 314 Codeforces Round 949 (Div. 2)

By zltzlt, history, 9 days ago, In English Hello, Codeforces!

We are glad to invite you to participate in Codeforces Round 949 (Div. 2), which will start on Friday, May 31, 2024 at 06:05UTC-4. Note the unusual start time of the round. 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 sinsop90, yinhee and me.

I would like to thank:

244mhq for his wonderful coordination. sinsop90 and yinhee for providing problem ideas and discussing the problems with me. AFewSuns and crazy_sea for providing a better solution to one of the problems. Um_nik for the only LGM testing. A_G, antontrygubO_o, StarSilk, CharlieV, rui_er and Andreasyan for red testing. FengLing, YuJiahe, CSQ31, small_peter and JWRuixi for orange testing. yinhee, QwQwf, lovely-ckj, wsc2008qwq and Jryno1 for purple testing. sinsop90, dieselhuang, Edwin__VanCleef, wtc, WRuperD, starrykiller and gdf_yhm for blue testing. Ender32k and liangbowen for cyan testing. ishaandas1 for the only green testing. cyz2010 and cppcppcpp3 for grey testing. MikeMirzayanov for the great Codeforces and Polygon platforms. Last but not the least, You, for participating! Scoring distribution: 500−1000−1500−2000−2500−3500 .

Good luck & Have fun!

UPD: Congratulations to the winners!

Div 2:

cyb0101 Feduk_Pro_Spb whale_0086 graphcity grass8cos Div. 1 + Div. 2:

maspy Savior-of-Cross Rubikun femboy-wannabe turmax Editorial and also Simplified Chinese Editorial are out.

Full text and comments »

Announcement of Codeforces Round 949 (Div. 2) Vote: I like it+357Vote: I do not like it Author zltzltPublication date 9 days agoComments 190 Educational Codeforces Round 166 [Rated for Div. 2]

By awoo, history, 8 days ago, translation, In English Neapolis University Pafos

Hello Codeforces!

The series of Educational Rounds continues thanks to the support of the Neapolis University Pafos.

On Thursday, May 30, 2024 at 10:35UTC-4 Educational Codeforces Round 166 (Rated for Div. 2) will start.

This round will be rated for the participants with rating lower than 2100. It will be held on extended ICPC rules. The penalty for each incorrect submission until the submission with a full solution is 10 minutes. After the end of the contest, you will have 12 hours to hack any solution you want. You will have access to copy any solution and test it locally.

You will be given 6 or 7 problems and 2 hours to solve them.

The problems were invented and prepared by Adilbek adedalic Dalabaev, Ivan BledDest Androsov, Maksim Neon Mescheryakov, Roman Roms Glazov and me. Also, huge thanks to Mike MikeMirzayanov Mirzayanov for great systems Polygon and Codeforces.

Good luck to all the participants!

UPD: Editorial is out

Full text and comments »

Announcement of Educational Codeforces Round 166 (Rated for Div. 2) Vote: I like it+203Vote: I do not like it Author awooPublication date 8 days agoComments 266 The 3rd Universal Cup Announcement (with Details of Upcoming Online and Onsite Event on June 23!)

By Qingyu, 8 days ago, In English

Hello everyone, we are happy to announce that the 3rd Universal Cup has started officially. Universal Cup is an organization dedicated to offering training resources for competitive programming teams. In the previous season, over 900 teams from more than 500 affiliations all over the world, registered and participated in a total of 28 stages, encompassing contests from Asia, Europe, and America. We also want to express our gratitude to our sponsor Huawei.

  • Semifinal and Summer Summit As announced before (Link), we will host the 2nd Universal Cup Semifinal on June 23, 2024. The contest will start at 17:00 (UTC +8) and end at 22:00 (UTC +8).

Any Universal Cup registered team can participate. If you are new here, please register following the instructions on Registration.

Register! Besides competing to advance to the UCup Finals, sponsored by Huawei, we also prepare prizes for teams in the top 10 (excluding onsite teams in the Summer Summit) . The prize details are as follows (may be replaced by products of similar value when processing):

Online Rank Prize for each team member (at most 3) Champion (Rank 1) HUAWEI WATCH GT 4 (46mm) Spruce Green First Prize (Rank 2 — 3) HUAWEI FreeClip Second Prize (Rank 4 — 10) HUAWEI Band 9 After the online semifinal, we will host a stream of all invited teams competing in the semifinal contest at the Summer Summit event in Cancun, along with problem analysis. The stream will start at 22:00 (UTC +8) and end at 03:00 (UTC +8).

English: YouTube (through tourist's account!)

Chinese: Bilibili (through jiangly's account!)

Here is a list of teams that will be competing onsite:

Team Member 1 Member 2 Member 3

1 USA1 (Andrew He, Kevin Sun, Gennady Korotkevich) ecnerwala ksun48 tourist 2 HoMaMaOvO (Riku Kawasaki, Masaki Nishimoto, Yui Hosaka) maroonrk maspy hos.lyric 3 03 Slimes (Kangyang Zhou, Mingyang Deng, Ziqian Zhong) orzdevinwang Rewinding TLE 4 Polish Mafia (Wojtek Nadara, Mateusz Radecki, Marcin Smulewicz) Swistakk Radewoosh Marcin_smu 5 Mei Dui Yao (Jiyu Shen, Qiuyang Zhang, Jincheng Zhai) PubabaOnO froggyzhang Chinese_zjc_ 6 Almost Retired Dandelion (Aleksei Daniliuk, Oleg Merkurev, Nikolay Kalinin) Um_nik Merkurev KAN 7 Let it Rot (Yi Qian, Bo Peng, Shiyuan Feng) skip2004 p_b_p_b Warriors_fsy 8 Yolki-palki (Vsevolod Nagibin, Denis Mustafin, Tikhon Evteev) Pechalka Kapt Tikhon228 9 yosupo (Kohei Morita, Takuto Shigemura, Ken Sugimori) yosupo sigma425 sugim48 10 Speed Star (Akihito Yoneyama, Kentaro Matsushita) YoshikaMiyafuji noimi 11 Amstelpark (Pavel Kunyavsky, Alice Sayutina, Mikhail Ipatov) PavelKunyavskiy cdkrot LHiC We also prepare prizes for this onsite competition:

Onsite Rank Prize for each team member (at most 3) Champion (Rank 1) HUAWEI MateBook X Pro i7 13th Silver (Rank 2) HUAWEI WATCH Ultimate Bronze (Rank 3) HUAWEI WATCH GT 4 Honorable Mention (Rank 4 -11) HUAWEI FreeClip - 3rd Season Online Stage As usual, this season's main activity is our online stage, where we hold weekly mirror contests. Please refer to our website https://ucup.ac/ for previous results. If you are interested in participation, please register following the instructions on Registration.

The online stage rule is still the same as last season:

Rules To provide more convenience, we implement a few more features on the system, including team composition, extra time window application, etc:

System Update Lastly, we would like to express our gratitude to MikeMirzayanov for letting us advertise Universal Cup in Codeforces and providing the great platform Codeforces and Polygon to help prepare contests. We are also very thankful to all contest stage setters for your support of the Universal Cup. If any setter would like to propose a stage, please feel free to contact us.

Universal Cup Committee:

Jingbang chenjb Chen Yuhao jqdai0815 Du Lingyu jiangly Jiang Yaowei Sugar_fan Lyu Qingyu Qingyu Shi Yaohui quailty Zeng Full text and comments »

Tags ucup Vote: I like it+268Vote: I do not like it Author QingyuPublication date 8 days agoComments 8 Code Weekend #1

By tourist, 3 weeks ago, translation, In English logo Hello everyone!

We, the RGBTeam (qwerty787788, Romka and tourist), are huge fans of heuristic programming competitions and are quite saddened by the fact that they are becoming less and less frequent each year. One day, we decided to organize our own competition :) Despite the fact that such ideas often remain just ideas, this time we have a serious mindset, and now we want to invite you all to participate in the first — and hopefully not last — Code Weekend #1!

The competition will be held in a format quite similar to ICFPC/Google Hashcode — there will be one problem and several dozen tests for it. You will need to submit just an output according to the rules of the problem for each test, which can be obtained using any algorithms, written in any language, and running for any duration of time. Midway through the competition, the problem statement will be expanded, and new tests will be added.

The competition starts on June 7th at 21:00 UTC and will last 48 hours. A day after it begins, on June 8th at 21:00 UTC, a second, expanded version of the problem along with a set of tests for it will be released. The competition ends another day after the release of the second version, on June 9th at 21:00 UTC.

The expanded version of the problem will be a superset of the basic version. For instance, if the problem is "given a chess position, find the best move," the basic version may only include pawns, bishops, and knights, while the expanded version will use rooks and queens.

The competition is team-based, and there is no limit on team size, but we've tried to balance the problem in a way that larger teams don't have a significant advantage over smaller ones. Therefore, the recommended team size is 1-4 people.

Unlike ICFPC, the focus of the competition will be on heuristic algorithms rather than functional programming (although in recent years ICFPC hasn't been focused on FP either).

Attention! The contest will be held on the website https://codeweekend.dev, you need to register there (once per team). All the announcements during the competition will be in the Discord chat, so join it via the link https://discord.gg/M6pG5zp3DF. Be sure to invite your friends, relatives, pets, and anyone else who might find it interesting :)

UPD. Our competition will be generously sponsored by the TON Foundation, for which we are immensely grateful!

As a result, the following prizes will be awarded in the competition:

1st place — 400 TON 2nd place — 300 TON 3rd place — 200 TON 4th place — 100 TON Additional prizes:

1st place after the first day of the competition — 111 TON. At the end of each minute of the competition, the current leader (provided there is at least one team with a positive score) receives 0.1 TON. 300 TON will be distributed equally for the best solution of each test at the end of the competition. For example, if there are 10 tests, and Team A has the best result in the first three tests while Team B has the best result in the remaining seven, Team A will receive 300/10*3 = 90 TON, and Team B will receive 300/10*7 = 210 TON. All ties are resolved by time — the team that achieves its result earlier ranks higher.

Thus, the total prize fund for the competition is over $10,000 at the current exchange rate.

Full text and comments »

Tags contest, heuristics Vote: I like it+989Vote: I do not like it Author touristPublication date 3 weeks agoComments 18 Codeforces Round #948 (Div. 2)

By Stefan2417, 2 weeks ago, translation, In English Hello, Codeforces!

After a year of anticipation and several complete changes to the problem set, we are glad to invite you to take part in Codeforces Round 948 (Div. 2), which will start on Sunday, Sunday, May 26, 2024 at 10:35UTC-4. This round will be rated for participants whose rating is below 2100. Participants with higher ratings may participate out of the competition.

You will be given 5 problems and 2 hours to solve them. All the problems in the round are created and prepared by Stefan2417 and alexchist.

The round may include one or more interactive problems. Please read this blog to get familiar with this type of problems.

We would like to thank:

Vladithur for excellent round coordination! A_G, JustNik77, AgafonovArtem, MADKIRUS, AndreyPavlov, PBBx0, Alexdat2000, RP-1, mwen, MrDelrus, tiom4eg, ezraft, TheEvilBird, Codula, Vamperox for testing the round and providing valuable feedback. MikeMirzayanov, geranazavr555, geranazavr555, vbandurin, ChurakovaAlexandra, medvezhonokok, Vladosiya and KAN for maintaining and developing the Codeforces and Polygon platforms! Score distribution: 500—1250—1750—2000—2500 .

Your perception of the scoring may vary, so be sure to read the later problems if you get stuck on one.

Upd: Congratulations to the Winners!

Div 2:

sun_gan_chou_yu_guan

Maksiwelle

suomynonA

new_mistakes

Kosyaaa

Div 1+2:

tourist

Sugar_fan

sun_gan_chou_yu_guan

abc864197532

BurnedChicken

Upd: editorial

Full text and comments »

Announcement of Codeforces Round 948 (Div. 2) Vote: I like it+276Vote: I do not like it Author Stefan2417Publication date 2 weeks agoComments 235 Codeforces Round #947 (Div. 1 + Div. 2)

By Bazoka13, 2 weeks ago, In English Hello, Codeforces! Or, as we like to say in Servalish (created by Serval): High-low, Cold-for-seize!

We are glad to invite you to participate in Codeforces Round 947 (Div. 1 + Div. 2), which will start on Saturday, May 25, 2024 at 10:35UTC-4. The round is a combined round and will be rated for everyone.

The problems are prepared by Atomic-Jellyfish, Nerovix, SanweiTreap, Serval, Toxel, jhdonghj112 and me. You will be given 9 problems to solve in 3 hours. Scoring distribution will be announced later.

We would like to thank everyone that makes this round possible:

Alexdat2000 for Russian translation. BFLSTiger and wzy2001wzy for providing some rejected problem proposals and discussing problems with us. 2sozx, JJLeo, YUKI_LELOUCH, Hanghang007, zlc1114, fried-chicken, zhicheng, fsfdgdg, H_W_Y, 200815147, CrTsIr, OMG_link, RDDCCD, SSerxhs, Tony2_CF, zhaohaikun, Hank2019, WZKQWQ, cxaphoenix, LGyxj, Oshwiciqwqq, fallleaves01, forget-star, monstersqaq, Narukara, Ricky2021, MagicalFlower, Saule_, kgqy, YSY_, dan_dolmatov, lowbob, sleepwa1ker, Nanako, Qingyu, Meatherm, PersistentLife2024, Vamperox, FransValli, skywalkert, shstyle, Lavine, kaichou243, gamegame, Cai_Guang, xhytom, qiuzx, Legitimity, Kevin114514, Adam_GS, htetgm, zengminghao, Melania, JCY_, yaoxi, schrodingerstom, jqdai0815, SSH_automaton, platelet and sjc061031 for testing the round and providing valuable feedbacks. MikeMirzayanov for the amazing Codeforces and Polygon platforms. You for participating in the round. We recommend you to read the statements of all problems. Good luck & Have fun! (=・ω・=)

A no-prize quiz UPD: Scoring distribution: 250-500-1000-1500-2000-2500-3000-4500-6000

UPD2: Editorial is available now.

UPD3: Thank you for your participation in this round! Congratulations to the winners:

tourist Golovanov399 maspy hos.lyric Um_nik And the first solves on each problem:

A: abdo3bkr B: Asaemon C: tourist D: tourist E: maspy F: tourist G: maspy H: Golovanov399 I: Ormlis UPD4: Chinese editorial is available now.

Photo of reviewer and some authors:

Full text and comments »

Announcement of Codeforces Round 947 (Div. 1 + Div. 2) Vote: I like it+586Vote: I do not like it Author Bazoka13Publication date 2 weeks agoComments 153 ICPC Alumni Event in Sillicon Valley 2024

By Temirulan, history, 2 weeks ago, In English

We invite you to first ICPC alumni event in Silicon Valley on June 4 at 6pm.

This is a unique event that will bring together top ICPC alumni and friends. The event will be attended by ICPC President Bill Poucher, Freedom Holding CEO Timur Turlov and Bagdat Mussin, President of the Kazakh Federation of Competitive Programming.

Register here: https://lu.ma/ICPC_Meetup

P.S: wdyt about some small entertainy contest?

Full text and comments »

Tags icpc Vote: I like it+163Vote: I do not like it Author TemirulanPublication date 2 weeks agoComments 23 Codeforces Round #946 (Div. 3)

By Vladosiya, history, 3 weeks ago, translation, In English Hello! Codeforces Round 946 (Div. 3) will start at Monday, May 20, 2024 at 10:35UTC-4. 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.

Round is based on UKIEPC 2024: Spring Practice. Please refrain from participating in this round if you are familiar with the tasks of this competition.

I would like to thank:

Authors of the original competition: Aksenov239, MaxBuzz, RobinFromTheHood, darnley, izban, pkhaustov, lsantire, az453, fedor.tsarev, Shoaib Jameel.

MikeMirzayanov for help with ideas and Polygon and Codeforces platforms.

-is-this-fft-, peltorator, tute7627 for red testing.

senjougaharin, kaikey, gmusya, nskybytskyi, Giga_Cronos, diskoteka for yellow testing.

TypeYippie, kzyKT, tepamid, ahshafi for purple testing.

Abo_Samrah, Zandler, sam07a, YESMAKHAN, xygzy, Klaus26 for blue testing.

Morvolzz, dasha..zhilina, sutekine, Muhsen, Gojova, Acanikolic73 for cyan testing.

You for participation.

Good luck!

UPD: Editorial is out.

Full text and comments »

Announcement of Codeforces Round 946 (Div. 3) Vote: I like it+186Vote: I do not like it Author VladosiyaPublication date 3 weeks agoComments 242 ← 1 2 3 ... 232 233 →

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov The only programming contests Web 2.0 platform Server time: Jun/06/2024 20:21:08UTC-4 (k2). Desktop version, switch to mobile version. Privacy Policy Supported by TON ИТМО

Полный текст и комментарии »

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

Автор pathetique, история, 9 месяцев назад, По-английски
  • Проголосовать: нравится
  • -8
  • Проголосовать: не нравится

Автор pathetique, история, 9 месяцев назад, По-английски

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

User Rating

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

User Contrib.

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

Name

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: [email protected] 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://codeforces.net/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 ИТМО

Полный текст и комментарии »

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

Автор pathetique, история, 9 месяцев назад, По-английски

include

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;

}

Полный текст и комментарии »

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

Автор pathetique, история, 9 месяцев назад, По-английски

Hello, pathetique! Your recent comments/blog posts/other activities have violated rules of our community. It seems this content is nonsensical, troll-like, dirty, coarse, offensive, aggressive, meaningless, violating other rules or ethical norms. Probably, it wasn’t written in English (or Russian if you specify this language for blog post or comment). Please, be polite, reasoned, do not publish junk content, do not violate conventional ethical standards. You should not publish content that does not correspond to the topic of discussion or does not correspond to the topic of the website. Use common sense when analyzing to write or not write any content. You should not publish comic content, especially if it is not interesting to a wide part of the audience, repeats the existing one, or has no connection with competitive programming. Your account has been blocked to write any social content for 48 hours and your recent content has been deleted. Hope you follow the relevant conclusions and this situation will not happen again. In case of repeated violations, more severe penalties may be applied to your account, up to and including blocking.

Полный текст и комментарии »

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

Автор pathetique, история, 11 месяцев назад, По-английски

I'd likes to thanks to CF community for helpeds mes reacheds lowests 50 users ins termss of contributions.

Полный текст и комментарии »

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