In competitive programming, constructive algorithm problems require building valid structures that satisfy given constraints. For this problem, given a string of pluses and minuses, the goal is to construct a permutation where pluses indicate the next element must be larger, and minuses indicate the next element must be smaller. The solution involves linking all pluses in ascending order and all minuses in descending order, then connecting them properly. The first element must be a plus and the last must be a minus for a valid solution to exist. This demonstrates how constructive problems can be solved by identifying patterns and applying systematic construction strategies.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
EGOI 2026 Day 2 Commentary: 2/3Added:
ended. So, you'll need to send a new [ __ ] stream link.
>> Yep. Send >> this. If you need to restart your computer, I guess, bro.
>> Okay, let's uh I sent you a link on Wait, no, that was the wrong stream. Got to send you got to find it on YouTube.
But we are live again. We are live again. How do you guys hear me properly now?
This This is not a cook, bro. If you need to restart again, bro. I am not liking this live.
>> Oh, yes. The stream ended, that's for sure.
>> Yeah, the new one started.
>> Yeah.
>> Okay. Anyway, I think we are live now.
So, let's just continue. Bro, turn off the thing. Turn off the echo.
Uh, Sonic.
>> Yeah, my mic is still not loud enough, >> bro. It's five, bro. Right now, it's not the time. So, got AC on B.
>> Oh, what?
>> And Clara also got AC on B. Yeah. 79 to AC.
>> Oh, what? That's >> crazy.
>> Yeah. And Mariza 41 on P3 right now.
Also, bro, can you hear the echo or is it just me? Uh, I can't I don't hear an echo.
>> Okay, wait. Let's try again. Yeah, I can hear an echo.
>> Wait, is my stream audio being shared?
No, it's not. No, no, there is no echo.
>> I think it's from your mic or something, bro. But don't don't turn because I increased the volume now.
>> Maybe. Maybe.
Yeah.
>> Yeah. This this is not a cook, bro.
>> Bro, I my APS got over yesterday, so I am pretty jobless now. That is true.
>> Okay, so we have 41. Is that the highest on P3 right now?
>> Metal predictions. What are medal predictions?
>> I mean, it's pretty obvious. Gold, silver, bronze, bronze from me. What about you?
>> Uh, Swasti's probably gold >> and Mani is probably silver, that's for sure. But Lyra and Dia, I don't know. I feel like one of them may drop to HM.
>> Oh, I was thinking Dia may get to silver if if today is really good.
>> What was Dia's yesterday?
>> It was like mid to upper bronze. Mid to upper bronze. Wait, where is Lyra right now? Uh, bottom of bronze. That's not a good thing to see, but >> I think it's good. As long as she pulls through near the end, it's fine.
>> Yeah. Yeah. So, right now, she's going really slow. What about Dia? How much does Dia have?
>> Oh, Dia is bigger and worse. All right.
So, well, it's not HM yet. We don't know that. It's just that she has 000. She hasn't even made any submissions. Yeah.
>> Yeah. Well, at least we're not dropping non HM or >> cuz that's that's not possible for us at this point. Everyone is at least getting HM.
>> I mean, bro, that's you sort of cook, bro.
>> Is that really something? Is that really something to be proud of? Like, really?
>> I mean, sure. If you have one gold and one HM, I think that's a fair trade.
>> I mean, I don't know, bro. I think you may be a little biased towards HMs, but I personally don't really like them. I think that the no medal would honestly be better than an HM because >> I mean at least when you have no >> you're going to have HM at the very least.
>> Yeah. Yeah, that's true. But you know what? Why are we even going to have HM?
We're going to have two bronzes. You know, I have a feeling I have a feeling.
Okay, so Dia right now, we haven't even given her a fair shot, so we can't even comment on that. Lyra, too, I mean, she's just warming up. We don't we don't even know what she's doing right now.
She's still trying P1 probably, but maybe she's trying P2. Maybe she's just going to AC P1 on her next submission. I mean, we don't know. We'll have to we'll have to wait and see for that.
>> Maybe Si is going to ACP4 on her next submission, but we know that's not coming.
>> Bro, you know, those two things are not equivalent, bro.
>> Like, like, okay, we don't have any submissions on P4 yet, right? So we don't even know how the subtask >> I think P3 is what's coming next.
>> Yeah. Yeah. True. We have Mariza with 41 which is everything but the last two subtasks, right?
>> Swasti is saying P2 is actually pretty insane though. And look at the time as well. 26 minutes for everything but the last and 33 for the last. I mean she's really doing something here. I don't know what I don't know what's gotten into her, you know, in a good way. Oh, first submission from there. And on P1, what do we think? Is it going to be 40 or 100 or zero >> for hopefully AC? I think it's AC.
>> Yeah. I'm going to go with 100 as well.
Let's have some faith.
>> I mean, she was taking so long. She had to be cooking an AC.
>> Yeah. Yeah. Yeah. Yeah. Let's see. Let's see. It could be 02. Okay. Yeah. There we go. There we go. It is an AC.
>> No, it was an AC. It was an AC.
>> Oh, okay.
>> All right. So, now where is Dia? So >> that's bronze.
>> This is the border of bronze. Dia somewhere here. And Okay. So Dia is like upper to mid bronze right now. Okay. You know, I don't think it's entirely unrealistic that she could go into silver as well. I mean, what do you think?
>> I would say it's probably a little unrealistic because you we are looking at the leader about 40 minutes in and there are going to be so many people who just grind out in the last 1 hour and get so many points. I mean, how how do we know that's the case, though?
>> It's it's an international competition there. Like 500. No, not 500. What? 200 400 people giving. There's going to be a lot of like people who just leave stuff up until the end and then they just start.
>> This reminds me, this reminds me of that what do you say the tourist strategy, you know, that he was talking about at Yukov. Have you seen that video?
>> No. What is that?
>> Uh, basically a tourist strategy. Uh it's a it's a longgoing tradition. It's basically when you just have all of the solutions to the problems, but you just don't submit. You have to throw off your opponents. By the way, keep in mind this is our ICPC. Okay. So over there, the participants can see the scoreboard. So they look at tourists and they see him not submitting problems and they're like, "Yeah, this is not worth attempting." Right? And then at the very end, he just makes five submissions, five sees like five of the hardest problems and just jumps from like here to here.
Oh my god, that's that sounds crazy.
>> And it's only someone who's like as good a tourist that can really afford to do that, you know, because you don't need to be confident in your solutions. And especially at like an international Olympia, I mean I personally I wouldn't have the guts to like hold off know potentially using a medal just to like aura farm. Like that's pretty much >> it's not about aura farming. It's about It's about say they have a solution for P1, but they're like, "Okay, I I my mind is fresh right now. Let me use that fresh mind to think on some P3, P4 hard stuff."
>> Oh, no, no, no. You misunderstood the You misunderstood the strategy. You code it as well.
>> That's strategy for II. I'm saying people who just think and don't code because in IO if you code might as well somewhere.
>> Right. Right. Right. Right. Right. Yeah.
cuz there's no live rank list in iOS.
So, doesn't really make sense. I mean, the only reason it would make sense is if for some reason you want to go from HM directly to gold in like 5 seconds.
Oh, we had someone getting it to gold right now as I said that. But, but well, yeah. I mean, I guess the only really effect it would have is like on people looking at the rank list and then they're like, how did this person just AC these problems in like 2 seconds? Not really an effect on the competitors.
>> Oh, yeah. And for the II stream, actually does that every single year.
>> So, >> oh, you can just watch stream.
>> Yeah. Right, right, right. Cuz we won't be able to do the same thing most likely, >> but I doubt this stream is going to be as professional and good as ours. I mean, okay, we ignore the fact that it died 25 minutes. I mean, that's just a minor hiccup. you know, we don't really talk about that, but there will be something else.
Okay, so I feel like P3 is probably going to be somewhat hard right now.
Now, this is really where stuff starts slowing down a bit. How's the Brazil team doing? Wait, let's look at the filtered rank list for a second. Let's see.
Okay, so we have Marisa in goal, in gold. Oh, look at this. Isn't this Oh, wait. I did not mean to do that. Uh, yeah. Oh, no. We Claraara is right at the top. I didn't even notice her cuz I'm so used to her being like number one, number two. Yeah. Okay. So, Brazil is currently leading. Then we have Cypress. Then we have India. Oh, this is not good. So, Dia Mani is silver, Dia is bronze, and Lyra is HM.
>> So, Lyra might be stuck up on P1 AC. not going to lie because we >> I think so too. But I think she is going to get it given how other people did get it as well and it is EGI P1.
>> The chat has a really interesting suggestion actually. What if you get the EGI girls to do the II commentary? So we switch spots.
>> Oh, right. We swap.
>> Yo, you know, wait, who made that suggestion?
>> Uh Hetros Sapion here.
Hm. We could get Lyra and like Swasti or you know like I think Lyra and Swasti would probably be like chill enough for that, right?
>> Let's see. Let's see. Let's see. IC and this time we can >> Yeah, we can make the proposal. Yeah.
>> Yeah. Right, right, right. That actually sounds pretty good. Although I mean it'll definitely then it will be on the on this channel as well, right? So >> yeah, >> it's like even better. Yeah.
>> Okay. But still, this is not looking good right now. Oh, and also this is something I just noticed. So, from Cyprus, we have Mariza who's like third overall rank, right? And then like if we just have a tiny look at her teammates, I don't think I don't think they're doing too well. I mean, if you look at day one, day two. So, I don't know what's going on in that country. I whatever situation there's this one guy who's just different >> different >> one I this is not even this [ __ ] situation I mean at least over there we had people getting silver silver it was a gold silver bronze so >> I mean did we have silvers last year I was the only silver we had two bronzes and an HM last year so >> oh yeah we we have an HM as well yeah but but we're talking about the time when Shiz was there right? Like at the time it was not that imbalanced, but this is like really a like next level of like I don't know what's going on, but I think it's fine. I mean, on the other hand, Brazil looks pretty balanced. Like we have gold, silver, silver, silver.
That's like very respectable.
>> Oh, and we have someone asking if EJ girls take our spot for II. I honestly don't think that's happening. Like >> I I think that's not very likely.
>> You've seen the cut offs. You've seen You see I know I cut off. We have another submission from Swasti on what is this? Is this P4?
>> Oh no it's not P4. It's P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P3. Oh, P3.
Okay, she had >> 41. Okay, 25.
>> It's 25. It was 25 for Mariza as well, I think. Yeah, first submission was 25. So >> 25 and then 60.
>> And Mara just aced T2 as we speak and she's overtaken Clara. Now she's third and Mariza is first. So, we we literally have a person from Cypress who's first and all of the others just at HM over here. Uh, with zero on day three, actually, it's like pretty crazy to think about.
>> Oh, no. They're not HMs. 29 on day one is not an HM. That That's no medal.
>> Oh, right. This is no medal. It's not even an HM. Okay, but no medal is better than HM, right?
>> What do you mean? Our scoreboard is laggy.
Oh, that's Oh, the scoreboard is laggy.
Wait, wait. So, are you talking about latency or are you talking about like like animations? Because latency is something, you know, like we can't really avoid because of YouTube. It's going to be like 10 or 15 seconds late.
Uh, but in exchange for that, like the stream is higher quality. The lag, I think that's just the website itself. I mean, I don't know. This website is worse than the leaderboard. I mean, I don't know why because they're using CMS, too. So they could have used the exact same template but for some reason they haven't which I I >> it takes longer. Yeah. Yeah. That's just because of the stream.
>> Yes. Can't really do anything about that. I mean we can but then the quality of the stream >> the stream quality would be a lot worse.
>> Yeah.
>> We're not going to do that.
>> So So I think it's a a reasonable you know like reasonable compromise here.
Yeah. Let's see. We have Okay. So Daria Pur Pere Pereopska, if I pronounced that right, was number one on day one. Right now she's number two.
>> Yeah. So the reason why that happens is cuz we also see it at the same time, but the stream latency is too long.
>> Oh, just as I was saying that, Dario is now number one again. I mean, yeah. Why is China not participating? For political reasons, I think >> they didn't participate. Why is China not participating? You actually know why?
>> I'm not sure actually. You want to search it up? Want to see what what that's about?
>> Let's see.
>> You You want to search it up? Okay.
Okay. Switch. Do it on your screen. Do it on your screen.
>> Right. Let's see.
>> I I'll have the leaderboard open here.
>> Okay. Let's switch over to my screen.
Okay. Hope you guys can see the Chrome window clearly.
And yeah, so if you look at the API 2020 six actually yes that that might be a reason because in APR 2024 all 60 of them aed.
>> Okay. You realize I think that was a joke, right? I did not [ __ ] think that was real.
>> So >> like you're out here saying this like oh yeah you know they they aka the entire contest all 60 of them. That's not the case. I I am 99% sure there was a joke.
>> Yep. And that's >> they had a different they had a different API. That's not even like not participating. That's them signaling that like you know we're too good for you.
>> Exactly. It's and it doesn't even make sense like if if you have a separate Olympia then how is it even API like what's what's the Chinese this is Chinese Olympia in informatics like >> yeah like >> this isn't really political reasons yeah I okay I think it has something to do with the fact that Taiwan was the host this year and I'm not much into like you know geography and stuff but I think there there was some controversy with like Taiwan and China like geographically speaking. So I think that's the reason they weren't a part of it. Yeah.
>> Yeah. Yeah. Yeah. Because I mean China doesn't recognize Taiwan. So if Taiwan is organizing Oh, so that's why China >> too.
>> Oh okay. I mean look I'm not complaining. If China gave then I wouldn't be in gold in the unofficial but the preliminary. be in bronze either.
>> I think I was like fourth in bronze as well. Like fourth last in bronze. So we both not complaining.
>> Yeah, I I think that's I think that's fine. I think >> Oh, yeah. Because there would be six Chinese and gold, right? Yeah, this is completely fine. I mean, whatever political reasons. I mean, look, China, they were too good for us anyway. They needed their own example, >> right?
>> That's in my opinion because >> uh you know what? You know what? I love Taiwan for this.
>> Yeah. I mean, Taiwan's Taiwan's just a goat now. I mean, there's a reason we both have There's the reason you have a gold. They're the reason I have a bronze. So, >> I we don't have them right now. We need to >> They're the reason we could potentially probably are going to 99% chance have them.
>> Probably >> if Yeah, probably. Yeah.
>> Okay. Okay, I think we can switch back to the scoreboard now.
>> Yep. Let's go back to you >> actually. Do you want to do you want to start looking at the P at the day one problems?
>> Uh because we >> we can't actually look at the day two problems, right? And I think the scoreboard is going to start moving a bit slow now. But you know what we can do? We can look at the day one problems because uh I actually had solved them right after the contest. So I know some of the solutions. Uh Samic, I think you tried P3. I think that's about it, right?
>> So, Sonic will actually be seeing the problems for the first time. So, you know, we can get his live reaction as well. So, let's do this. Okay. So, let's let Sonic explain P1. Uh or let's actually like let him try the problem and then see how fast he solves it. Uh we'll be all judging him on stream and let's and then he'll explain the solution. Uh if he fails to, I'm always there. So, uh that's fine, right? So, I'll leave it up to you. You can go ahead and open the problem.
>> Let's see why.
Now, we have this. Oh, yeah. We can delete the CMS thing that we cooked up yesterday as well.
>> Oh, yeah. Yeah. So sad. It stayed up for 12 hours or something and it's overtaken.
But that's fine because our CMS did not support like our CMS did not support P4.
So >> we spent a lot of time on it. Come on.
That's >> We spent like 1 hour on it. We spent like 1 hour.
>> Should I Should I time this cuz I've never seen the problem before.
>> All right. You know what? Go ahead.
>> Let's Let's time it, guys. Let's see.
Let's get >> Yeah. And switch to your screen, too.
Uh, stopwatch. Okay.
Yep. All right.
Now, keep in mind that the goal is CC this in less than 5 minutes. So, if you don't, that means they're going to overtake you in IOTC. They're not going to go to IO this year. I mean, keep in mind there are four goals.
>> Is this >> Well, start.
>> Okay.
>> All right. city's signature. Oh yeah, by the way, everyone else can read it as well. I'm not going to speak it out loud.
>> Uh once someone is done reading, I'll just summarize the problem because I know that people don't like to read.
I mean, at least I don't. So, uh so tell me when you're done reading it.
>> Yep.
H.
Okay.
And I think I get it.
Yeah, I think I get it. Yeah, sure. You can you can go ahead and explain. This is >> all right. So, as far as I remember Yeah, you can stop the timer so you can think in the background while I explain.
Yeah. Yeah, that's that's totally fine.
Yeah. All right. So, basically, you're given >> Yeah. Yeah. So, basically, you're given a number n and you're given a string of length n consisting of pluses and minuses. Now if there's a plus at position i that means that you need basically you need to construct a permutation and that permutation should be such that if there's a plus on number at position i then the number that comes after it and the permutation must be bigger than it. So for example if there's a plus on zero then like 1 2 3 could come could come after it. If there's like a plus on one then 2 three could come after it but like zero couldn't because that would be an invalid permutation. Now if there was a minus on it, it's like exactly the opposite that like if you have a three, you could only have 0, one and two after it. Like by after I mean immediately after, by the way, and you need to either say that a permutation following the string is not possible or you need to construct one. So that is the problem. All right, Sonic, you can resume your timer and >> you know start thinking with time that's actually counted.
>> Okay. Okay. Okay, let's let's open up Zern. That's my favorite uh drawing editor, by the way.
>> Yeah, this guy for some reason uses Windows and uses a Linux drawing tool, which I don't really understand, but I'll leave it up to him.
>> Is this is this better than Linux in my opinion?
>> That opinion is wrong, but you can be a title to your own, I guess.
>> See, Nvidia Nvidia has just [ __ ] Linux in the ass. like you use Nvidia, you can't really >> Okay. Yeah.
>> All right. All right.
>> Yeah.
All right. Okay. So, if we have a plus - plus - - plus. So, the first thing that I'm thinking of is if we have all of the pluses, we can probably like link them together.
And we can do the same thing for the minuses. just link them all up in the chain.
And then how do we like link these together? So if if this minus if this minus was actually over here, we could link it up and we can link it up here. So that means that the last thing needs to be a minus and the first thing needs to be a plus.
And we could probably say that that's a that's a requirement because if the zeroth index is a minus then you can't have an answer because there's nothing less than zero and n minus one being plus is also wrong because you can't have anything greater than n minus one.
So >> okay that was actually impressive cuz that is the correct solution. That's exactly the solution I coded. It gets AC. You basically just told the pluses ascendingly and the minuses descendingly and that's literally it. Yeah. How much time did that take you? Like three minutes. Okay. You know what? Let's make let's make that 5 minutes because I was explaining and you were thinking a bit during that.
>> Okay. But I was straight up to explaining my solution after I thought for that 2 minutes.
>> I don't know man. I don't know. I don't know if you I don't know if you're going to count that. What do you guys think?
Do you do you think we should give him the benefit of the doubt? I don't think so. But but yeah, that that is a correct solution. All right. You know, this is actually kind of embarrassing, but I took like 15 or 20 minutes to solve this. I mean, personally, I'm just like very very bad at like uh what you can call these kind of problems.
Constructive problems. Yeah, that's the word I'm looking for. So, why don't you go ahead and just like code this up in the Q editor, >> you know, like no ID.
>> Just just to see if you just just to see if you still have it. I mean, it's a pretty easy problem, right?
>> I think I'm going to make it harder for me. I'm I'm going to code it in Notepad.
>> Okay, fine. Notepad works as well.
>> Not this Notepad. This This Notepad Microsoft has made it [ __ ] trash.
>> No, no, no. Don't use Don't use an actual ID. You need to use You need to use either Notepad, this one, or the Qog editor.
>> Oh, no. I'll use Notepad++ without syntax highlighting. That's It doesn't have autocomplete. So, it's basically the exact same. It's just monospaced.
So, >> is this Java code I see?
>> Yes.
>> Wait a minute. Weren't you dissing me for using Java just some days ago?
>> This is for APCSA.
>> Or do I remember wrong?
>> This is for APCSA brand. This like doesn't count.
>> Anyways, let's let's code it in Java only for fun.
>> Wait, can you submit in Java? You should probably check that out before you Yeah, I don't think you Oh, wait. Can you just scroll down? Okay.
>> All right. There's some Chinese things.
The package of a Java program should not be specified.
Oh, okay.
Okay. Come on, bro. You're going to make it difficult for me.
>> Okay. Go ahead. Java.
>> Okay.
>> Yeah. Yeah. Public static void main.
Let's go, man.
How many people here have taken Java in school? How many people here know the trauma associated with it?
>> You need to import java scanner. I'm pretty sure you know >> and then we have >> unless you have >> uh so okay there's a scanner class.
>> Yeah. But you need to import that >> and it was system.n I believe >> it was it was that's correct.
import scanner. I don't know what the imports are, unfortunately.
>> Java.scanner, dude. I mean, this is just >> See, now there's a Java programmer here.
I think it's pretty clear.
>> Yeah. I mean, I know the basics. All right. I know the basics.
>> Oh, IC has Java. That's interesting.
>> What is ICC?
>> ICE the board you >> ICC. Yeah. Yeah. Right. Right. That's the reason I know it. Yeah. Like >> uh let's do s do.can int.
>> Okay. It's s it's s. Next. Dude, this is like >> Okay, I see. Okay, guys. Guys, guys, I had a reference for APCSA. Okay, I'm I'm doing this as like an AP exam. You have >> Yeah, you're not doing that well at this AP exam, bro.
>> We have this. We have this. Okay. So, I'm going to You know what? I'm going to use this. Let's Let's keep it fair.
>> Oh, yeah. Let's Let's just pull up the cheat sheet, you know, >> the official cheat by myself.
>> Yeah. Cuz I don't know how to do Java myself. Let's just pull up this cheat sheet that tells me everything. Yeah.
Yeah. All right.
>> Yeah. I has to be capital, for example.
>> Yeah. Right. That That was a very unobvious fact, right?
>> Yes. I I don't know. I I'm not used to it. Okay. String S of length N consisting of characters plus and minus.
Okay. So let's just use a string S is equal to S dot.
>> You can't call both the scanner and the string S. You need to call it str or something.
>> All right. Let's call it str. That's fine. Whatever.
So >> now let us make a loop starting from zero str.length and uh okay so we have string char which is equal to str sub.
>> You can't call the variable char cuz that's a data type's name dude. I mean what what is going on here man? I didn't know I they don't have the char data type in APA.
>> All right.
>> They only have this int boolean and uh double primitives. So >> that's all I know.
>> Okay, >> bro. Char at is a function that exists.
I don't know what what you're cooking up here, but >> I don't see you can use equals to compare.
Oh, no. I I was joking when I said that actually.
>> All right, man.
Uh >> boolean array.
Okay. Why do we need a boolean array?
>> Uh to interpret the string.
>> Uh we don't need to interpret the string, right?
I think it's going to be better if we do interpret it cuz >> like we can just do a forward pass and a backward pass. Like you don't need to store any sort of like information.
>> Yeah. Yeah. That it's it's going to be easier for me to code if I store that info.
>> All right, man. I mean, if you say so.
Currently, you have taken 4 + 2, that's 6 minutes. So I think if you don't code it in like 20 seconds you'll be worse than my >> so sorry not man you'll be worse than swasti >> or if that is plus then what's the output if it's not possible >> it's just no n o capital >> system out dot print ln no it's really hard to code without. Okay. What's early exit? I don't know how to early exit. Oh, I can just return.
>> No, you I think you can, but system dot actually. Yeah, I think return should also work. All right.
>> And uh otherwise it is possible. So let's sprint line. Yes. And then we have n integers >> and we justation itself. So let's let's just create a integer array answer which is new.
>> Oh this is this this is not a cook man.
I mean >> uh >> I could have coded this on Python faster than you and you know how bad I am at Python.
>> I mean I learned Java and I'm coding it without syntax highlighting without autocomplete in Notepad. So hey, we aren't really the same person. Okay.
Okay. Okay. If you say so. If you say so.
>> We're not the same person. Remember that.
>> Yeah. I don't code in Java. So, I think I can agree.
>> Oh, so is the last thing meant to be like a pointer?
>> Yep.
>> All right.
>> So, if uh Okay, you know what? Let's let's code it in a pretty way.
If >> Oh, by the way, by that he means unreadable >> for people who are new.
>> If not at AI. Okay, I'm getting a call.
Wait, let's listen to who's calling.
>> Hello.
>> Yeah.
It has been 6 minutes >> process two of thinking.
>> Okay. Yes, I'm I'm back. I'm back.
>> Why is coding in this disgusting language? I swear to God. I don't know.
I think something's got in the t like some days ago he was telling me that NodeJS is ours as well.
>> NodeJS is ours. So >> So it's like he said he's starting to like Java, JavaScript, all these like like second class, third class languages.
>> Don't call them third class. They're the best languages. They were literally given to us by God himself.
>> Oh, really? Really? All right, man. By the way, you need two brackets to close.
Like you do not like have two brackets where >> uh you opened an if bracket, right? So you have the four bracket and the if bracket, bro, the four >> four doesn't have an open bracket, s it's an inline for bro.
>> That's what I said. Let me code it in a pretty whim.
>> Okay. Does that even work in Java?
Yes, I am coding it in this disgusting language because this language is so ours, isn't it?
>> It's not. But are you entitled to your own opinion? I guess >> it is. You You're just trying to cope.
>> All right, bro.
>> System.out.rint.
He >> should be done any second now.
Um okay what do we output? We just output the integer. So answer of five plus we output the empty string >> space >> and we do system.out.print ln.
>> All right. So do you want to check your code? You want to submit it right away?
What do you think?
>> I think we're going to do a test run.
>> Oh, really?
Oh [ __ ] >> Highlighting.
>> I mean, it's all right. You already coded it off. So, I'll I'll let this slide.
>> No, no, no. We got to disable.
>> Apologize to God for this. I don't think you understand. Wait, is this for Node or is this for Java?
>> It's for Java. It's for Java.
>> Okay, for Java, I mean, bro, all I'm saying is the rules are super strict.
Like it's a super simple language. It's like C++ you can do whatever [ __ ] you want and the the >> Yeah. And this guy was like coming to me and being like why does while one not work >> while and he was like losing points. He was like no why am I getting so mad. I'm like dude like you deserve this. If you guys have looked at any of his score in C++ like ever you know what I'm talking about. Okay, let's just let's use nano as well.
>> Making it worse, but all right. Rules are strict and that's that's why it's a simple language because the rules are strict.
>> Basically, it means that like you know if a language has many rules, that's like very complicated, right? Like you can do the same thing in like 10 different ways, but that's not the case with Java.
Uh Java doesn't exist.
>> It's util, not utils.
>> Okay. I mean that's your fault.
>> My fault.
And you're the one that wrote imports scatter. So I mean my >> imports are not expected to be written in the AP exam. You're supposed to just use the classes and expect that they are imported.
>> Oh, okay. Okay. My bad, man.
Wait, is that a zero? Okay, zero. All right.
>> Yeah. Okay. So, >> wait, wait, hold on. Just go back to your thing real quick. Two zero. Does that say two 0?
>> Can see 0 is connected to >> Should it be 02?
>> What?
>> Shouldn't it be 02? Not 2.
>> No.
How can it be? How can be zero connected to zero?
No, zero connected to two.
>> Yeah, zero is connected to two. Yes.
>> Uh that's why zero should be first.
>> What?
>> Yeah. Okay. I mean, you can go ahead and submit and uh let's see if it works.
>> Did I not read the output format correctly?
>> I think you didn't. Yeah.
>> Oh, wait. No, no, no, not not this, right? Otherwise, I'll see syntax highlighting.
Let's get ready for the wrong answer.
>> Error. What? Main method not found in class answer do main. Oh >> yeah. See this is what I was talking about by the way yesterday. So I think they fixed it in the new version but in the old version you need string ors.
Okay.
>> This is an old This is a newer version.
Tower 21.
>> All right, let's see.
>> We have Okay, we we see.
>> Yeah, that's what I was talking about.
Like basically, you need to enter output zero too.
Uh, >> so I think I read the output incorrectly.
>> Yeah. Yeah, I think so.
Oh, on a valid. Oh my god. Then it's trivial, bro.
>> Then the answer is so trivial. I thought they they wanted me to print out something else.
>> Yeah, that's why I was like, you can just use two loops. Why you doing this boolean thing?
>> Yes.
>> And you're like, no trust in the Java or something. And I was like, >> okay, God. God.
>> Yeah. But guys, this is the truth of Savic, man. problem. AC in 6 minutes runtime error plus it's wrong.
I'm sorry.
Yo, you guys have seen that all today. I don't even know what to know what more we could have.
>> It's I I plus an empty string and >> Oh, wait. What were you printing?
answer. What >> the cabin I is connected to?
>> Oh, I get what you mean. Okay. Okay, I see. No, no, no. You just have to print I. Okay. Okay, I see. So, now you should get AC.
>> Yeah.
>> Wait, what? Why is it? What is it? 1 3 4. No, this is still wrong.
>> No, one is connected. Oh, did I do the reverse order?
reverse order. I think I did reverse order.
>> It's if AFI and if not AFI. Yeah. Yeah.
Yeah. Exactly.
>> Yeah.
>> Now you have AC. Yeah. Now submit this.
>> Okay guys, that was just a small hiccup.
I think bad.
>> Just a tiny. Just a tiny.
>> I mean to be fair, I misunderstood the problem. like I didn't read the output format correctly.
>> Right. Right. It's not his fault, guys.
>> Come on, bro. It's their fault. Yes.
>> You see?
>> All right. Okay. So, yeah, >> that's how we solve P1.
>> Explain my stomach.
>> That That is called a cook, guys.
>> Explain your gold medalist.
>> Don't look at the 17 minutes, man. Who said don't? No, no, no. Look at this.
Look at this. Look at the fact that I coded it up in Notepad++ without syntax highlighting. I coded this in Notepad with a box of scraps. Like >> you're coding this up in your fancy ass IDE. We are not the same person. Like >> All right, man.
>> We are not the same person, guys. Like, like, no.
>> All right. I I think it's time to just have a quick look at what's going on in the leaderboard.
>> I think we may have missed some things.
Let's have a look. Let's have a look.
>> Switch over to a Vegna again.
>> Okay, so how are we doing right now?
Okay, so I think we stopped off somewhere over here, right? We have some submissions. Okay, we had a submission from my on P3 getting subtask number four.
Okay.
>> So, and but no subtask number one, two or three. Just directly to four. And look at her submission history, too. 23 22 23 0. So, I don't know what she's trying for. And it's pretty rare that you see subtask number four being easier than the first three. You think she may be going for AC? Actually, you know, it could be possible. 1 2 3 are special cases, then four and five are just like the full solutions.
>> It is possible. I think the subtask four is a special case. Subtask three is a special case. And then >> we just have another submission from right as we speak on on P3 as well. All right.
>> That's an AC. She she's going to cook.
>> No, I don't know. I I >> I think it's going to be three subtasks.
So, like the first two.
>> First one. Not that bad. No, pretty close. Pretty close. Okay. So, that's subtasking really nicely. What's Lara doing?
Let's let's check up on Many. She also got 79 on P2 which as we decided was pretty like normal but pretty doable to get given by the leaderboard. So that's pretty good as well. Uh then what do we have? We have Swasti with P1, P2, P3, sorry, a subtask 1, 2, and three on P3.
>> Hasn't done anything in a while then, right?
>> Yeah. No, no, she >> Oh, she got Oh, she got subtask three.
Okay, it's pretty respectable.
>> That's fine. Yeah, that's fine. Okay. Uh then we have a submission by Lyra.
>> Oh. Oh, this is not looking good. Okay, so it seems that she has moved on from P1 and gone to P2, which is actually okay. So, there's two ways to see this, right? On one hand, P1 was an AC problem. So, ideally speaking, she should have gone AC on or not. But also, it's good to not get stuck on the same problem for a while. So maybe she'll come back to P1 in in some more time.
But yeah, right now it's not looking that good.
>> Okay, wait. I think your stream uh your webcam is lagging a bit. I mean, someone said in the chat as well. And by the way, this the reason why I look way more smoother than him is cuz I'm the one streaming. So it's going directly from me. Well, for Agna that data is coming from his computer to my computer and then mine to YouTube. So, it's like double compression as well.
>> I hope it's not that bad, right? I mean, because it's also like we using Streamlabs, what is it called? Collab Cam. Yeah. So, this is going to be like way better than if I was on call with him and he was streaming that call or something. So, I think at least the audio quality is fixed because of that.
So, it's like better than nothing.
>> Yeah. Plus, I think he's on like a worse webcam than usual today anyways cuz >> Yeah. Yeah. Yeah. That that's also contributing to it a bit. Yeah. Okay.
What are our medals so far? So, we have we have gold, silver, bronze, HM. So, I think on day one Nan predict predicted that these would be our results. I mean, I hope it's not the case. Oh, just as we speaking, we have two submissions from Lyra on is that P2? I think that's P2.
and Swasti on P3.
Oh, another submission from her on P3.
Could she be going for subtask four or even?
>> I hope that's a subtask four. Let's subtask four is going to be good.
Subtask four is going to be mighty.
>> Lyra did not get more points unfortunately. Many also made a submission right now. Okay, so she's going to get two and three as we were talking about.
>> Yep.
>> Yeah. Yeah. This is all. Oh, so Swasti could get subtask number four. Okay, she she got a zero now. But since my has subtask four, it seems very in the realm of possibilities that she could easily get subtask 4, too. Okay. And my has subtask one and two. Okay, so now there's just three remaining. All right.
>> Yep. I think they all are cooking pretty hard. Like man is easily doing silver.
>> Yeah, man is getting silver. That's true. may even get gold if she gets lucky. But she would need to ACP2 for that. I'm pretty sure. Like I have a feeling gold this time is going to be P1, P2, 100. P3 is probably going to be it's probably going to be Yeah, it's probably going to be 64 and P4. Well, actually, we have no way of saying what P4 would be cuz there's been no submissions so far. So, >> I mean, we are 1 hour 20 minutes into the contest, right? These people are Oh, Swasti 54 was the 64. That's subtask four. I see four.
>> Oh, all right. There you go.
>> That's GG's.
>> Okay.
And this is pretty insane. I think Si was like rank 11 or seven. Now she's like sticking on. Oh, why did my page just refresh? I mean, all right. Let me just select the teams again. Uh, by the way, if there's any >> day only. Let's let's look at day two only. I mean, now it's getting pretty interesting.
>> Okay, let's see. Oh, Swasti is rank three when you only consider day two.
That's interesting.
>> Yep. Swasti is cooking really hard. Just one subtask left on P3 and then P4 is like a zero. And Mani is cooking pretty hard on P3 as well. So Mani should get 64 on P3 as well. Just 21 missing on P2.
>> Right. Right. Right. And the now the thing about this 21 on P2 is at least according to EGI standards either this is tedious to code or she's missing like a very small idea.
>> And the the bad thing about that is it's not that likely that you get it if you leave it behind. But maybe >> I'm asking for IIY teams.
>> H let's see.
>> It's actually pretty hard. I don't know who the third and fourth person are going to be. I mean if it was like really confusing >> I feel like it's going to be Avanch Abhinav or Man at least one of them because they were really really strong last year and >> you know he >> True and and strong as well.
>> Yep. And they're going to be done with J now at least Avian will be. So they're going to be grinding two weeks happening J was happening during the time of right.
Oh no J.
>> Oh, Jay is tomorrow. All right. Well, good luck to everyone giving it here.
>> I don't think you should be watching the stream right now if you have Jay tomorrow. By the way, just saying.
>> Right. Right. Right.
>> Yeah.
>> Although maybe, you know, I mean, personally, I think EGI is more important. That's what Lyra thought as well. That's why she was planning to give J, but she ended up not doing it to go to EG, which is actually like really cool. I mean, imagine having to go to an international Olympia and not giving a J exam. Like, >> how would she get means?
>> I'm not sure actually. I haven't asked her.
>> Oh.
>> H. Okay. Wait, do we have any submissions on P4 at all? Oh, we don't.
>> P4?
>> Oh my god. Okay.
>> I mean, people are probably just waiting for P4. Like, >> yeah. Is it too early? Is it too early?
>> Yeah, it's Maybe it is too early. Okay, but oh my god, look at this. We have 100 100 by two people on A, B, and C. This did not happen until like a lot later on day one. A day when P3 was actually pretty interesting, but I mean looking at the problem, I did not think that there would only be two ACs. Oh, and just as I said that on day two, we have three ACs, which is already more than how much we had on day one. So, by the looks of it, okay, by the looks of it, P1 and P2 are definitely ACable. We have so many ACS on P2. P1 is like most definitely AC.
P3, I have a feeling is probably going to be doable as well. P4, we still have zeros. Like, we literally don't have a single submission. Do we wait, do we not have a single submission or do we not have do we not have like a single non-zero score? Because there is a difference.
Hm.
I think there's no submission at all, right? Oh, no. We do have a submission.
>> It's way too early. Everyone's probably just focusing on maximizing first three problems.
>> Okay, we have a submission from Lyra.
Oh, which unfortunately is still just a nine on P2.
Again, this is like the kind of thing that makes you wonder what the problems are, you know? Is it like some kind of problem like you know like a greedy kind of problem which which even I would struggle on or is it like a >> it's something more simple?
H wait actually do you know if Pakistan participates in the EGI?
>> I don't think so.
>> Oh they don't they don't. Okay.
>> How is Japan doing?
>> Probably need a lot of money for that.
Not going to lie. and >> oh okay I see I see I mean I guess it is Europe after all so let's look at Singapore as well okay so we're looking at Singapore and why we not looking at Ukraine we need Ukraine too cuz they were the winners on day one okay let's see so we have Ukraine in the lead then Mariza which is like who's like fourth and then her team members oh look at that one of Mara's team members has 40 on P1 so they're not four zeros. So, >> I don't think they're meddling. So, >> unfortunately, you may be right. But, but hey, this is still pretty good, right? If you look at it, like this is she's like the absolute best in her country. Then we have her. It's probably like, you know, we can have some conversations together about some problems. And then these two people who uh still need some time to get better.
All right. But anyway, we have Japan, two goals, and where's the fourth Japan?
Oh, we have two golds, one silver, and one bronze for Japan. I actually expected Japan to be a little bit stronger. What about you?
>> I mean, that's pretty good. One gold, two silvers, one bronze.
That's super strong, >> but it's But it's Japan. We need to keep in mind that Japan is insanely strong.
Like three Japanese guys in API, I think.
I mean, you're pretty strong, too, man.
So, that's not a valid benchmark, right?
So, >> I'm not that strong. Like, it's like >> Okay. Okay. To be fair, we did just see you trying to code EGI P1. So, I guess >> that was pretty strong. That was pretty strong for the conditions. Like, I mean, you want to do P2A in Python without autocomplete.
Bro, I haven't ACP2 normally either and I've read the problems actually. So, it wouldn't be that fair for me.
>> Okay, you can we can do like a CF800 d.
I think that'll be pretty good.
>> Bro, I have not solved a CF problem for like 10 years and I am not on my laptop right now. I'm going to actually have to code a notepad. Like, >> yeah, I'm also going to code it in not that's the point. I we both are going to code it in notepad.
>> H, you know what? Maybe we can do that.
But probably we should discuss the problems first, right? And then after after that gets done, you know, we can start doing stuff like CF duels maybe.
>> Let's see.
>> I have to log into CF over here as well.
I don't know if I even have You know what? That should be probably possible.
Okay, let's Oh, we just had another Ukraine person jump to gold. Okay. Okay.
So, what about Brazil? Brazil is currently at one gold. Oh, Clara's doing a lot worse today than she was on day one, which is interesting.
>> She's doing pretty good. 25. That's just two subtasks left. She's She's >> Yeah, but but last time she was at rank two, rank three for like pretty much the entire time. Like did not drop below that. Uh okay. But we have one gold, two silvers, and one bronze. All right, I see. What about Ukraine? Ukraine is two golds, one silver, one bronze. Singapore is wait Singapore has no goals. Okay, we have three silvers and one zero score from Singapore. Wow. Okay, >> that is interesting.
>> Cypress only have three contestants.
probably again because of budget constraints cuz >> they did >> one African country in II and they only sent one guy like literally just one person.
>> But do you remember that one guy from II? I forgot his name but he got like 0.43 points or something like that.
>> 0.43 Jason something. Yeah. Yeah. Some Jason something, bro. I I don't remember his exact name. Maybe someone over here knows. There's one guy.
>> I don't remember. And I'm so sleepy today cuz I woke up too early. I You know, this guy woke up and I called him the live stream. He's like, "Wait, it's now the entire reason this thing is late. I mean, that's like his fault, guys." So, >> no.
The freaking silence of shame is crazy, bro.
>> No, wait. Can you not see my cam?
>> No, I can. Oh, I can only see like a small portion of it. What are you doing like this?
>> Yes.
>> Oh, okay. Okay. I mean, I would I would say agree, but like whatever you say, man. Okay. Wait, hold on. Do we think that P P3 AC is doable? Do you think that some of these people do you think Mara is getting AC on P3? What about Swasti? I don't think Swasti is getting AC on P3.
>> Uh what about Clara and Mariso?
>> Clara again I don't know. I don't think P3 P3 AC is probably something non-trivial because if all three ACs are trivial then gold boundary is going to be very high and we can't have that.
>> That's true. That's true. And and yeah, I mean if all three ACs are trivial and then just D is just like a like a problem where everyone gets zero, then the deciding factor is just going to be day one.
>> Yeah. What did we have as the goal cut off on day one?
>> Goal cut off on day one I think was 100 + 100 + 71 + 11. How much is that? 271 + 11 is 282. Yeah, I think that was the goal cut off.
>> Yeah. Yeah.
>> Yeah. So we should expect something along that line for today as well.
>> Yes. Right now we are at 220 being the gold cutff. 100 + 79 + 41 + 0. Oh. Oh my god. You see this? We have our >> first tasks. What are those distributions? Okay. 65 last subtask.
>> This was the same thing as yesterday actually. Do you think this is a communication problem as well? I don't know. Communication, but that's definitely a partial graded problem.
>> Yeah, like communication/ interactive is what I mean.
>> Interactive maybe.
Maybe. I don't think we're going to have two communications. That would be historic, I think.
>> Oh, really?
>> I mean, two communications in Eg. That's That's absolutely crazy.
I mean, at least in the mock given, there's always been like one communication per day. I don't know. I think it's pretty normal.
>> I don't think so.
>> H how 11 is the highest on D? Yeah, there's only literally one person from Australia with 11 points on D and that's pretty much it.
>> Okay, but that means D is also still doable. So, people have not done a round doing D yet.
H I'm kind of concerned about Lyra right now. I mean 40 + 9 and I don't know what she's trying right now. Wait. So >> she's still going to get Okay, let's let's try to run predictions maybe.
>> Run predictions >> on cut offs.
>> Cut offs. Uh total cut offs or let's just do just day three, right?
>> Yeah. You know what? what we can do. So you you know the trick I used for predicting API cut offs to a really good accuracy.
>> I mean you were like off by like 25 points.
>> Yeah. But that was exactly my error.
Like I calculated my RMSSE and that was exactly it. So >> plus or minus 20.
>> Yes. Okay.
>> So that means it's plus here we'll have like 300 400 data points. So it's going to be way more accurate and we can probably train like a small neural network.
neural network.
I mean, I don't know much about AI myself, but if you think that is possible, I mean, >> yeah, I'll leave it up to you.
>> By the way, do we know if the cutffs on this website are accurate? I think it is right. This is just based on like top 50%, top 25%, top 12.5%, right? The the bronze colors we see on screen over here.
>> Yeah, I think so. Oh, yeah. Wait, just find the ranking for EGI day 3. Uh, EGI 2025 day 2.
>> EGI 2025 day 2. I think we can find it.
Uh, >> uh, not the complete ranking like the timed ranking.
>> Oh, the timed ranking. Is that even there?
I don't think that exists because last year they had it on cat, not on CMS.
>> Oh, but okay. We can you can we can use day one as the donator then.
>> You know, try doing that. I mean, we have the contest moving a little slow now anyway. So, let's let's do something interesting.
>> I mean, how long do you think it's going to take?
>> Well, it shouldn't take more than like 15 20 minutes.
>> All right. I mean, do you know how to import the data from the website?
>> Yes, sir. Let's let's let's switch to me then.
>> All right. Go ahead.
Okay, let's stop now.
>> Uh, till then I'll just make a rough prediction uh just based on wives, you know, and we can compare it to how well his thing does as well.
>> So, >> just based on wives, I feel like the gold cutff is going to be 100 + 100 plus 48 plus Oh, you know what? Let's not make it 48.
I think it's going to be 100 + 100 + 64 + 9. Yeah, I think that's what gold is going to be.
>> Okay, so 136 137. Let's just use the cut offs at 137.
>> Ooh, wait. Is this not copyable?
>> Oh no. Is this not copyable?
>> I think you can copy. Just come on. See?
>> Well, that did not work.
Oh, >> I mean we probably we can probably like do this, right?
>> All right. This is not a cook, man.
>> Okay. Okay. It's a binary file, so I'm not reading binary files right now. Um, okay. We have I have All right. Let's just let's just try and see if we can inspect element our way into it.
I don't think I don't think this is a coke man personally speaking.
>> Oh yes, these are the rows. Yeah, these are the rows and this is the div.
So >> also I'll just be right back. I just need to get something to eat. Uh, and I'll be back in two.
>> All right.
Let's see.
Seriously iron cuz why not?
Wait, how do you switch to just day two?
How do you just day two leaderboard?
>> Oh, >> uh, just click on the day two. Yeah.
>> Okay.
>> How's it going? Are we making any progress? I >> think so.
Yeah, we're we're still still the same place. But let's let's run the predictions now.
Let's uh do it at 140.
Okay, this technique is kind of cringe, but why not, right?
It's okay, Sonic. You don't need to pretend like we don't do this all the time.
H >> let's use >> let's use fast one.
>> You know what I think? You know what I think we can do? I think while you figure this out, I can probably just go over yesterday's no day before yesterday's P2 with with the stream.
You think that sounds like a good idea?
>> Oh, wait, wait, wait. This didn't work.
No, I mean, okay, sure. Let's switch over to you then.
>> Yeah, just go ahead.
>> So, >> okay. Wait, let me also just go ahead and take a small break in the meantime.
>> All right. Sure. I'll continue. I'll continue explaining P2 till then.
All right. So, let's pull it up. So, EGI 2026 QJ.
Oh, can you not access the problems unless you log in?
Wait, hold on. Cuz this is not my computer. So, okay. Okay, wait. What if I go here?
Okay, that works. I think biscuits was P2.
All right. Yeah, so we No, Biscuits was P3. Oven Masters was P2. All right, there you go. So, we were did manage to bypass that. All right. So, for the people who haven't read the problem, uh the problem is basically that we have we have n people. Okay, so basically we are uh we essentially need to imagine a permutation uh which represents n people and their relative rankings. So with these n people there are also m tables. Uh the ranks go from zero being the best rank to n minus one being the worst rank. Now what happens is uh for example if the permutation is something like 103 542 people sit down on the table. So in this case n is equal to 5 m is equal to 2. The first two people sit down on the tables in the order of their arrival. Uh then for the remaining people they follow a specific procedure.
So what they do is uh let me just read this verbatim. Uh each time a baker that is a person arrives they choose a plate with a worse rank than theirs but still something better than them. So that is essentially like kind of like a lower bound. So for example, if I had numbers 1 2 3 4 5 or if I had 1 2 3 4 and six and a baker with number five arrived, then they would choose the number four cuz four is the biggest rank that is still worse than that is still better than them.
So they do this procedure and after they do that they replace the number that they chose with their own number and this procedure keeps on happening.
Now the one question may be that like what if you have 1 2 3 4 5 but then zero arrives and everyone over there is worse than him. In that case nothing happens.
The zero is just skipped and we still have 1 2 3 4 5 in the table.
So that is the procedure that happens and at the end we're going to have something like this right where we have the tables and we have the numbers that are stacked on top of them. This is what is given to us in the input. And what we need to do is we need to reconstruct the permutation that was possible that that could have caused this to happen. Uh so in this case one permutation that could have caused this to happen is 1 03 542 because if we simulate it 1 0 goes in the bottom. Then three will pick out one cuz it's the best one. Then five is going to pick out three from 0 and 3.
Then four is going to pick out uh sorry not four. We're going to have 1 35 right. Yeah. So four is going to pick out zero from 0 and five and two is going to see four and five two is smaller than all of them. So it's just going to get skipped entirely and we get exactly this order. So does the question make sense?
Uh people over here or maybe I'll just read the question verbatim once as well just to ensure that it's that's all good. So you're a reporter at the excellent glutenous oven masters and they went for n pizza bakers of Italy compete to decide who makes the best pizza. Each baker baked one pizza.
The pizzas were ranked by a jury. Each one received a distinct rank from zero to n minus one. And the baker received the same rank as the pizza. Then after the competition, it's time to eat pizzas. They will attend the event. Not everyone will bring and everyone will bring their own pizza. They arrive one by one in some order. There are m less than or equal to n tables. The first first time bakers who arrive place their pizza on the tables.
After that, a baker each time a baker arrives, they choose the available pizza with the worst rank still better than theirs. They sit down at the table to eat their pizza. Finally, they leave their own pizza behind on the same table for another baker to eat afterwards. If no pizza exists because all tables have pizzas ranked worse than their own, then the baker leaves frustrated and takes the pizza with them.
Now we need to construct the permutation that could have possibly caused this to happen. So that is what the problem says. Now if we need to so let's read this out. Uh solutions with a correct first line yes or no that's whether it is possible at all to construct such a permutation.
If we get that correct we get 20% of the points. If we get that correct and we get any valid order not necessarily the lexographically smallest permutation then we get 40 points. And to score a full 100 points, we need to output yes or no correctly. And if it is yes, also lexographically smallest permutation.
All right. So does that make sense?
Is anything going on right now? Boom. We have a submission from D by Swasti.
Okay. I don't think anything happened, right? Let me just really quick just confirm that. Yeah. Okay. Okay.
Nothing's going on right now. We still have Swasti Mani. Still have Lyra at 40 + 9. All right. Okay.
So, now the solution to this problem, we're going to start looking at the subtasks. Okay.
So firstly we have m is equal to 1 that means there's only one table. If there is only one table then the order the participants come in is pretty much okay so let me just draw this line. The order the participants come in is pretty much going to be the order that the permutation has to have.
Now there's one caveat with this and that is that if you notice what the problem statement says if we just go back to the problem statement it says something very particular and it is that a pizza a new pizza only sits at a place where the rank is already better than theirs. So that means that on each one of these stacks if you even look at this example the stack is always going to be sorted uh so the smallest element is at the bottom and the biggest element at the top. So the second we have something like 3 1 2 we know the answer is immediately that like no it's not possible right so that's that's one of the cases that's one case where you can rule out the answer not being possible.
Now the other case which I'm going to again look at this example for. So we have 13 5 4 0 which I'm going to write over here 1 3 5 4 0. All right. So over here we can see that one number that is missing is two.
Now if you think about what they said when we need a number to be missing. So hold on. How do I change my pen's color?
Can I not do that?
I think I opened something.
Uh, but I don't know how to Oh, exit zen mode. All right. Yeah.
Okay. Uh, let me just draw the line over here. Yeah. If we have 1 3 5 4 0. In that case, if we have an element like two that occurs over here, also wait, I wrote this wrong. This is this is meant to be 0 four. If you have an element something like two over here, it's going to look at everything and it's two is smaller than five and two is smaller than four.
And that is the reason the two is actually discarded. So if you're looking at a condition for an element E to be discarded, the condition looks like E should be less than every single element over here and every single element over here. If if we have e is less than four and e is less than five, then it's basically like saying e is less than min of 4a 5. So it's going to be min of I'm going to call that a z and a1.
All right? Does this kind of make sense?
Now we are going to look at this case for in this case it was just two that was missing.
But if there was another element like there was another element. So let's say this was E1, but we also needed it the same exact condition to be true for E2.
In that case, we have E2, E1 is less than the min. So if there's two elements that both have to satisfy a condition of being less than something else, then in that case, this is going to become a max and those are our two conditions. So these are the two conditions that make it so if they are true the solution is feasible and if they are false the solution is not. We need max of all of the missing elements to be less than the min of all of the elements at the top.
Now the lexographically smallest part when we are adding elements in this sequence we need to ensure that the element we are adding is always less than the things at the top. But as we add more of these elements, the top only ever increases what what that implies is that there's going to be some points over here. Two is missing, right? So if we had this stack over here, three and four, that is fine. Two is still missing over here. So we can put the two down. But if it was but if it was something like this stack now two is bigger than this one over here. So we wouldn't actually be able to do it.
So that is what we need to keep in mind as well.
Uh I think these are these are like the two main impossible conditions. So if we satisfy this then how so now we now we have reduced the problem essentially to this subtask over here where the sum of ti is all equal to n.
In this case, the solution is actually pretty simple. All we have to do is we first look at these elements over here.
Uh so these ones which are just inserted by default and then we scan upwards and we look at each element at the top over here. We choose the minimum of them and we put it over. We choose the minimum of them and we also have to ensure that when we pick that element. So if we pick a three over here then that three is going to go to this one and not to the zero. In this case that's true because one is the only element before it. So if we l all possible stacks like this and keep choosing the min and keep updating this condition is always going to continue remaining to be true. And if we greedy construct the permutation in this way it turns out that that works.
So just scoring this verbatim as I said is going to get you till this subtask.
It's going to get you 70 points. In order to optimize this to a full solve, all we need to do is just make sure that these stacks work out better. So all I mean by that is that we need to make sure that we are able to compute which is the minimum element on top of which stack very fast. And you can do this in multiple ways but I used the segmentry indexed by B where B is the top element.
Uh and then you can just binary search on that.
So hopefully that makes sense. If you guys have questions, please ask. Uh I did rush a bit in this explanation, but hopefully some of it made sense. The long story short is basically just that we need to long story short is basically we just need to greedy look at the element on top of each stack and choose the smallest one that follows this order of the things. And that that turns out to work.
So that is P2.
All right, let's go back to the leaderboard. Let's see if there's something that I missed.
Yeah, so we have we still have Swasti at the top. 100 + 100 + 64.
Uh my is still at 179 48. Somehow she hasn't gotten subass yet, which is pretty unexpected.
Uh and she did try for it. 121 151. So there was definitely some effort made by her. Dia is still Did make a submission?
Dia is still at 100 + 31. So there's no progress there as well. And Lyra is still at 40 + 9, which is pretty unfortunate.
But there's still time left. We are approaching the halfway mark, but not there yet.
And let's not filter the scoreboard. Let's see how the others are doing. Okay, so we have the first person at rank one being a US being from the US. Wow. Okay.
US wasn't doing as well yesterday. So, >> hello.
>> Oh, hello.
>> Yes, back.
>> Yes, sir. Hello. Welcome back. Yeah. So, US is somehow at the top now. How about the other US people? How are they doing?
USA.
Let's filter the rank list.
Okay, so we have one US over here, two US in silver, and one US in honor honorable mention. What is going on?
Have you ever seen a US in the honorable mention?
>> Yeah. I don't think historically I don't think historically US has ever got an HM. Like what is going on?
>> I think they they got a bronze in IO 25 if I remember correctly.
>> Wait, I can't sell you silver for the life of me. And you're telling me that there's people in the US that get through bronze, silver, gold, and platinum and some manager 25 rank list. Let's see.
>> There's no way that's true. I know scored two US people in the I this year and I'm low silver >> United States.
I >> mean Rain Boy obviously like >> yeah we have one gold.
>> Oh two bottom silvers. Oh my god.
>> And yeah one of them silvers is below me >> and one bronze >> and that to like mid bronze. Not even like high bronze.
Okay.
>> No, it it is somewhat high. Somewhat high.
>> United States.
>> It's so high. That's not as high as it should be.
>> That's true. How is this even happening?
Brian Zooie is like, oh my god. He had gold ranked three in 2024 and now he's at low silver below.
>> Yes, sir.
>> That doesn't even make sense. Yeah, I think you are somewhere over here. Yeah, you're also at the boundary of silver and bronze, but you are still above Brian Zoe.
>> Yes. Isn't that cool?
>> That is pretty cool. Yeah, but it's also it's also like how does this even happen? How does this even happen?
Stuff is pretty unexpected. I mean, let's log the scoreboard. We're tracking too many teams right now. I can't even see where India is.
Yeah, I think a lot of people right now are just stuck at 100 plus 100 plus 64 or 100 on P3. I think the problems are probably going to get significantly harder by this point.
Yeah, I mean probably it'll be some time until we have some updates. Maybe we should take a break.
Yeah, maybe. Maybe we can just leave the rank anchor on as well.
Yeah, let's let's take a break then.
Let's come back in like an hour and a half.
>> Yeah.
>> Have something interesting happening by that point.
>> Yeah. All right. Cool. Cool. Cool. I'll just turn off my camera. I'll keep my screen on and you keep sharing my screen. Okay.
>> All right. Sean.
>> Yep. Cool.
Related Videos
Agentforce NOW AMA: Build with React and Salesforce Multi-Framework
SalesforceDevs
490 views•2026-05-28
How agent o11y differs from traditional o11y — Phil Hetzel, Braintrust
aiDotEngineer
450 views•2026-05-28
Re: 🗣️📍theprophedu📍2026 GST 103 CLASS (E-EXAM REVISION)
theprophedu
636 views•2026-06-04
WEB TECHNOLOGIES UNIT-2 | Degree 4th sem BCOM Computers web technologies unit-2 full explanation💯✅
LearnwithSahera
1K views•2026-05-29
More tests are always better? How to use AI to identify tests that bring little value
Alliance4Qualification
335 views•2026-05-29
Search Algorithms Explained in 60 Seconds! 🤖💨
samarthtuliofficial
218 views•2026-06-01
People of Game of Thrones using JavaScript DOM
AltCampus
296 views•2026-05-30
Instagram accounts got PWNed
EricParker
13K views•2026-06-03











