Practice Problem Set – National Olympiad on Informatics 2014



well hello everyone i'm ivan french rosko and i have an important announcement to make so first off I receive an an an announcement from Facebook to go to this side and away that pH okay so actually this is the National Olympiad in informatics the Filipino leg so actually they say that it's the first but there have been several tries for the fee for the Philippines and contingency to join in the International Olympiad in informatics as far as I know it goes way back to 1999 but hopefully this note it would push through so actually the competition is today is June 2014 the competition is will be held on June 28th exactly 1:00 p.m. so the purpose of this video is to give you an overview of the competition as well as solving some of the problems so first when you browse the site it gives us a link on where to practice okay actually it redirects you to step changing actually during this time of the recording the contents of the website change so good thing I've saved the previous link for their further problem set so just go to hacker rank so the name of the contest is Noi – pH – practice so that's n oh I not not Olympiad in informatics – pH – price so we'll try a couple of problems actually in there outside give us provided a link in which you could download their PDF so their problem set consists of six problems and hopefully by the end of the video would we'll be solving three of them okay so the first problem is who is the oldest the actually this is quite trivial so we're just given three three integers in which these are the ages of adding birth and Carla and hopefully that's in years okay so the goal here is to output which is the eldest of the three I'll be in birth or card so the inputs are in order I'll be invertible and cardless each respective okay so our constraint is pretty much simple we just have to input an integer from 1 to 100 e so actually in the problem set okay for the first problem the crater subcommittee shot has been kind to us they gave us the solutions for C++ C and Java so in this case for the three problems I'll be using the Java programming language so the conventions for this video we'll be using proxy r1 from 0 to in proxy 3 as our project ok and as stated in the should as far as I know as stated in the rules of hack around whenever you use Java your class name should be solution so if we introduce a class file competition suggest that we use the classic scanner there are various ways in which you would input a forget input from the from the keyboard in c and c plus plus it's rather simple we just have to use scan F or C in in C++ but in this case they suggest at least scammers will be having three variables a B and C and then just use the method snacks and depending on the data type of your variable and then are for which case it's an integer it's like with next so in the inter solution we didn't close the scan one to be safe in this case I'm missing something I haven't program in Java for a very long names haven't done problem is pretty much trivial and it also says here in the problem statement that none of them have the same age so there is notice that either a B or C are of equal values our solution is pretty much straightforward so actually um whenever you go to hop around its it prompts you to create a new account so it's pretty much friendly it's pretty much you user friendly right there in Nick your Facebook account and just create an account so whenever you pick up on test and select a problem set just select a problem here the interface is pretty much good so we're programming in Java whoa actually I've saw during the last few tries again so it's pretty much copy and paste okay from your ID or no it provides a very nice facility for us to compile run and test our program so they're test cases a the corresponding input and output as has been already done for us it's quite more convenient than some other programming competition tools I've used the the Valladolid one line judge and an top coder but for me soon the other convenient thing we use chattering okay so we passed our desk a so up actually when you're competing you have test cases from the problem set and the judges have their own test cases different from that of the problem set so if you click Submit code they will run a bunch of tests ESS so let's just wait for a couple minutes okay so in this example the problem set has two test cases okay okay so this is our run right so if we click view and view results it says here that the site ran 30 this cases and all of which success so in order for you to get a point for this problems that you have to pass all of the judges test cases so that's the goal of the competition okay next we have the second problem this is a solution in C and C++ right okay the next one is entitled the playground fights so to make this thing simple we just have three inputs in an integer and two strings okay and the the integer has a range of 1 to 100 thousand and there are two words of length n which is your first input so the goal here is to print okay the number of okay there are two words so there are corresponding letters for each word you just have to count the number of different corresponding letters so in this case let's have the sample input one so we have two two letter words so she would not is in position to be ng or different letter so we just have to count it that's one for sample input 2 we have two ten letter words so position C forward so can we forget just forget this method so although I haven't used seeing in it's also many years if I'm in algorithm competitions mode I forgot the main method anyway so let's another variable is defines the number of different characters traits from the first letter position zero to the last letter position and minus 1 so actually see sure a program a c-sharp it's pretty much convenient at than Java because I could define a string to be of lower case which I have a since classes are strictly in uppercase letter so to use that and then in c-sharp and it's e it is this never know it has to be a method use this nope has to be turn it first sorry forgot the worried well run it again let's go back to the problem said just click on the challenges link so it shows us that the pace is fast let's submit ok so this time how many test cases are there for the judge okay so the on the judges side they have 22 test cases and all of which pass so that's two points okay two out of six problems have been sold so I see what notice the problems are quite trivial but if you take a look at the other problems it's much more more challenging so for this problem set we have two easy problems to mother3 moderate problems and one difficult so the next problem is called stream triangle so for the extreme triangle we have rather an extensive input so for the first line we have n number n which is which has the range from 3 to 100k and then for the next end lines we have a pair of inputs X&Y where in x and y denotes the position of a point so the goal of this problem is that even endpoints you have to find the largest triangle okay so the largest in terms of area so the police you have to find the area okay and then multiply that by two so the output format okay requires us to input twice the area of extreme triangle okay so okay so another thing to note that for the input no subset of three dots of the given points will be collinear and all of the dots will have distinct ordinate so this ensures us that all of all of the three dots for all of the three that's the exist in the input they would have an area which is greater than zero they are not collinear and they're not and follows that they are not coinciding they are not equal in x and y's so that so take though this is a time competition so every bit of cut and paste helps so if you it would it will be to your advantage if you have a template for in and if you have a snippet wherein you put input and then X x and y we must have a system to store them so just do some array all right then close the scanner okay so that we are finished in the section wherein we take an input so next how do we solve this so I've stumbled in stock exchange which is which has a formula that is given to us so first I tried the Shoeless formula but I haven't read and understand the formula fully well I'm having trouble finding where my body is so I would set up for the second best answer which is this one so the formula for the area of a triangle given three points x1 y1 2 x3 y3 is just the absolute value or 1/2 of actually this are a sum of products so the product of x1 and y2 minus y3 plus x2 times y2 minus y1 plus x3 times y 1 minus y 2 so X 1 X 2 X 3 so so since this is x1 we just get a difference of y2 and y3 for 2 this is reversed we have the difference of y3 and y1 x 3k it's increasing decreasing increasing decreasing increasing and then we are taught twice the area so this is X 2 so we have 3 n 1 then we have to get their absolute values okay we have function for getting the area twice the area of three points so how do you use that three so take no that will be iterating the re 3 times so we'll just have a very naive reason for that so let's say we have stationed purposes for the let's say we have 10 points we hydrate from for the first point point 2 we just iterate and index that is greater than point 1 ok so let's say point when I show me the point 1 has a value of 1 so we I tell it from 2 then next is fine 3 so point one has a value of 1 point 1 and point 3 has a value of 1 greater than index of point so that's the strategy yes I know it's not that efficient but let's try – because we have 3 points a point 2 is 1 index greater than point 1 in point is 1 index 1 into n for the value of 0.3 and minus 1 see the RT C the our okay so we define two variables here so we first is the result we are finding the largest area so we have defined our zone to be the list of our values of the area so that's how my evening program everything it's for the largest a second one this makes 136 fine so we just go ahead and submit this it's compiler running tests okay so for the trick best case SK has a success it also see that for the one with the ten point input okay so it submitted C or how many of the judges test cases are there okay okay so our program run for the judges 19 dusties or so all of them are successful we got a point for them so this concludes our video for the practice problem set for the National Olympiad in informatics or for the next video actually a week before the actual competition which is on which is less June 21 the National indicated an informatics released another problem set this time this is a timed problem set so as far as I know the competition goes I'll just check a petition okay okay says in the title that the competition is good for five hours so last week they have a competition so the one that we saw earlier is entitled Noi – pitch – practice but this time is Noi – eh – problem expect that competition so you have five hours to solve six problems using any of the languages C C++ and Java or Java you have a requirement that your last fractional solution that's all for now so I guess I'll see you in the other video so again this is Francis thank you for watching

2 Comments

  1. Easy Direction said:

    what does infomatics mean

    June 29, 2019
    Reply
  2. harry potter said:

    Sir I want help in solving problems of international olympiad of informatics level.

    I would be thankful if you would upload a video on solving such complex problems as early as possible

    June 29, 2019
    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *