{"id":295173,"date":"2019-11-25T21:00:09","date_gmt":"2019-11-25T21:00:09","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=295173"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=295173","title":{"rendered":"\u0412\u044b\u043f\u0443\u0441\u043a#26: IT\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0430 \u2014 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u043e\u0442 \u0432\u0435\u0434\u0443\u0449\u0438\u0445 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0439"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/spice\/blog\/477460\/\">\u0421\u0440\u043e\u0447\u043d\u043e \u0432 \u043d\u043e\u043c\u0435\u0440! \u0412\u043e\u0437\u0440\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u0440\u0443\u0431\u0440\u0438\u043a\u0438 IT\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438. \u041c\u044b \u0432\u043d\u043e\u0432\u044c \u0441\u043e\u0431\u0440\u0430\u043b\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0438 \u0437\u0430\u0434\u0430\u0447\u0438, \u0437\u0430\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u043d\u0430 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f\u0445 \u0432 IT-\u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/dn\/i1\/sd\/dni1sdddswzqee4cijesuvw8rlo.png\" alt=\"image\"><\/p>\n<p>  \u0412\u044b\u043f\u0443\u0441\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043a\u0430\u0436\u0434\u0443\u044e \u043d\u0435\u0434\u0435\u043b\u044e \u2014 \u0441\u043b\u0435\u0434\u0438\u0442\u0435 \u0437\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438! \u0420\u0443\u0431\u0440\u0438\u043a\u0430 \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0435 \u0440\u0435\u043a\u0440\u0443\u0442\u0438\u043d\u0433\u043e\u0432\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442\u0441\u0442\u0432\u0430 <a href=\"http:\/\/www.spice-agency.ru\/ru\/\">Spice IT<\/a>.<\/p>\n<p>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0443 \u043d\u0430\u0441 \u0437\u0430\u0434\u0430\u0447\u0438 \u2014 \u043e\u0447\u0435\u043d\u044c \u0440\u0430\u0437\u043d\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u2014 \u0441 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439 \u0432 \u0438\u043d\u0434\u0438\u0439\u0441\u043a\u0443\u044e \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044e Flipkart. \u041d\u0443 \u0447\u0442\u043e, \u043f\u0440\u043e\u0448\u043b\u0438 \u0441\u043e\u0431\u0435\u0441? <a name=\"habracut\"><\/a><\/p>\n<h2>\u0412\u043e\u043f\u0440\u043e\u0441\u044b<\/h2>\n<p>  1. <b>Thief, Treasure and 2 Doors<\/b>  <\/p>\n<blockquote><p>A thief has just found a pair of ancient treasure caves. One of the caves is filled with unbelievable treasure and the other has a fire breathing monster that will eat anyone who opens that cave.<br \/>  One cave has a black door decorated with diamonds and the other cave has a brown door decorated with sapphires.<br \/>  Each of the doors has an engraved description on top. The descriptions say:<\/p>\n<p>  <b>Black Door:<\/b> Monster is here.<br \/>  <b>Brown Door:<\/b> Only One Door speaks the truth.<\/p>\n<p>  Which door should the thief open?<\/p><\/blockquote>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0435\u0440\u0435\u0432\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\u0412\u043e\u0440 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u043d\u0430\u0448\u0435\u043b \u043f\u0430\u0440\u0443 \u0434\u0440\u0435\u0432\u043d\u0438\u0445 \u043f\u0435\u0449\u0435\u0440. \u041e\u0434\u043d\u0430 \u0438\u0437 \u043f\u0435\u0449\u0435\u0440 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u043d\u0435\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u044b\u043c\u0438 \u0441\u043e\u043a\u0440\u043e\u0432\u0438\u0449\u0430\u043c\u0438, \u0430 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043e\u0433\u043d\u0435\u0434\u044b\u0448\u0430\u0449\u0438\u0439 \u043c\u043e\u043d\u0441\u0442\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u044a\u0435\u0441\u0442 \u043b\u044e\u0431\u043e\u0433\u043e, \u043a\u0442\u043e \u043e\u0442\u043a\u0440\u043e\u0435\u0442 \u044d\u0442\u0443 \u043f\u0435\u0449\u0435\u0440\u0443.<br \/>  \u0412\u0445\u043e\u0434 \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043f\u0435\u0449\u0435\u0440\u0443 \u043f\u0440\u0435\u0433\u0440\u0430\u0436\u0434\u0430\u0435\u0442 \u0447\u0435\u0440\u043d\u0430\u044f \u0434\u0432\u0435\u0440\u044c, \u0443\u043a\u0440\u0430\u0448\u0435\u043d\u043d\u0430\u044f \u0431\u0440\u0438\u043b\u043b\u0438\u0430\u043d\u0442\u0430\u043c\u0438, \u0430 \u0432 \u0434\u0440\u0443\u0433\u0443\u044e \u2014 \u043a\u043e\u0440\u0438\u0447\u043d\u0435\u0432\u0430\u044f \u0434\u0432\u0435\u0440\u044c, \u0443\u043a\u0440\u0430\u0448\u0435\u043d\u043d\u0430\u044f \u0441\u0430\u043f\u0444\u0438\u0440\u0430\u043c\u0438.<br \/>  \u041a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u0434\u0432\u0435\u0440\u0435\u0439 \u0438\u043c\u0435\u0435\u0442 \u0432\u044b\u0433\u0440\u0430\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u0432\u0435\u0440\u0445\u0443. \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0433\u043b\u0430\u0441\u044f\u0442:<\/p>\n<p>  <b>\u0427\u0435\u0440\u043d\u0430\u044f \u0434\u0432\u0435\u0440\u044c:<\/b> \u043c\u043e\u043d\u0441\u0442\u0440 \u0437\u0434\u0435\u0441\u044c.<br \/>  <b>\u041a\u043e\u0440\u0438\u0447\u043d\u0435\u0432\u0430\u044f \u0434\u0432\u0435\u0440\u044c:<\/b> \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430 \u0434\u0432\u0435\u0440\u044c \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043f\u0440\u0430\u0432\u0434\u0443.<\/p>\n<p>  \u041a\u0430\u043a\u0443\u044e \u0434\u0432\u0435\u0440\u044c \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0432\u043e\u0440?<\/p><\/div>\n<\/div>\n<p>  2. <b>Find ages of daughters<\/b>  <\/p>\n<blockquote><p>Alok has three daughters. His friend Shyam wants to know the ages of his daughters. Alok gives him first hint.  <\/p>\n<ol>\n<li>The product of their ages is 72. Shyam says this is not enough information Alok gives him a second hint.<\/li>\n<li>The sum of their ages is equal to my house number. Shyam goes out and look at the house number and tells \u201cI still do not have enough information to determine the ages\u201d. Alok admits that Shyam can not guess and gives him the third hint<\/li>\n<li>The oldest of the girls likes strawberry ice-cream. Shyam is able to guess after the third hint.<\/li>\n<\/ol>\n<p>  Can you guess what are the ages of three daughters?<\/p><\/blockquote>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0435\u0440\u0435\u0432\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\u0423 \u0410\u043b\u043e\u043a\u0430 \u0442\u0440\u043e\u0435 \u0434\u043e\u0447\u0435\u0440\u0435\u0439. \u0415\u0433\u043e \u0434\u0440\u0443\u0433 \u0428\u0438\u044f\u043c \u0445\u043e\u0447\u0435\u0442 \u0437\u043d\u0430\u0442\u044c \u0432\u043e\u0437\u0440\u0430\u0441\u0442 \u0435\u0433\u043e \u0434\u043e\u0447\u0435\u0440\u0435\u0439. \u0410\u043b\u043e\u043a \u0434\u0430\u0435\u0442 \u0435\u043c\u0443 \u043f\u0435\u0440\u0432\u044b\u0439 \u043d\u0430\u043c\u0435\u043a.  <\/p>\n<ol>\n<li>\u041f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438\u0445 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u043e\u0432 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 72. \u0428\u0438\u044f\u043c \u0433\u043e\u0432\u043e\u0440\u0438\u0442, \u0447\u0442\u043e \u044d\u0442\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0442\u043e\u0433\u0434\u0430 \u0410\u043b\u043e\u043a \u0434\u0430\u0451\u0442 \u0435\u043c\u0443 \u0432\u0442\u043e\u0440\u0443\u044e \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0443.<\/li>\n<li>\u0421\u0443\u043c\u043c\u0430 \u0438\u0445 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u043e\u0432 \u0440\u0430\u0432\u043d\u0430 \u043d\u043e\u043c\u0435\u0440\u0443 \u043c\u043e\u0435\u0433\u043e \u0434\u043e\u043c\u0430. \u0428\u0438\u044f\u043c \u0432\u044b\u0445\u043e\u0434\u0438\u0442, \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u043d\u0430 \u043d\u043e\u043c\u0435\u0440 \u0434\u043e\u043c\u0430 \u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u0442: \u00ab\u041c\u043d\u0435 \u0432\u0441\u0435 \u0435\u0449\u0435 \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u00bb. \u0410\u043b\u043e\u043a \u043f\u0440\u0438\u0437\u043d\u0430\u0435\u0442, \u0447\u0442\u043e \u0428\u0438\u044f\u043c \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442 \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f, \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u0435\u0442 \u0435\u043c\u0443 \u0442\u0440\u0435\u0442\u044c\u044e \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0443.<\/li>\n<li>\u0421\u0442\u0430\u0440\u0448\u0430\u044f \u0438\u0437 \u0434\u0435\u0432\u0443\u0448\u0435\u043a \u043b\u044e\u0431\u0438\u0442 \u043a\u043b\u0443\u0431\u043d\u0438\u0447\u043d\u043e\u0435 \u043c\u043e\u0440\u043e\u0436\u0435\u043d\u043e\u0435. \u0422\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u0442\u0440\u0435\u0442\u044c\u0435\u0439 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0438 \u0443 \u0428\u0438\u044f\u043c\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0443\u0433\u0430\u0434\u0430\u0442\u044c \u0432\u043e\u0437\u0440\u0430\u0441\u0442 \u0434\u043e\u0447\u0435\u0440\u0435\u0439.<\/li>\n<\/ol>\n<p>  \u041c\u043e\u0436\u0435\u0442\u0435 \u043b\u0438 \u0432\u044b \u0443\u0433\u0430\u0434\u0430\u0442\u044c, \u043a\u0430\u043a\u043e\u0432 \u0432\u043e\u0437\u0440\u0430\u0441\u0442 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u0442\u0440\u0451\u0445 \u0434\u043e\u0447\u0435\u0440\u0435\u0439?<\/div>\n<\/div>\n<p>  <\/p>\n<h2>\u0417\u0430\u0434\u0430\u0447\u0438<\/h2>\n<p>  1. <b>Tom and Jerry<\/b>  <\/p>\n<blockquote><p>Since very long time Tom and Jerry have been fighting with each other for a piece of Cheese. So finally you came to rescue and decided that the result of the fight will be decided by a mathematical game, in which you will write a number N <code>(1 &lt;= N &lt;= 10^6)<\/code>. Tom and Jerry will play the game alternatively and each of them would subtract a number n <code>[n &lt; N]<\/code> such that <code>N % n = 0<\/code>. <br \/>  The game is repeated turn by turn until the one, who now cannot make a further move looses the game. <br \/>  The game begins with Tom playing first move. It is well understood that both of them will make moves in optimal way. You are to determine who wins the game.<\/p>\n<p>  <b>Input:<\/b> the first line of each test case consists of N the number.<br \/>  <b>Output:<\/b> print 1 if Tom wins and print 0 if Jerry wins in a separate line.<\/p>\n<p>  <b>Constraints:<\/b><br \/>  <code>1 &lt;= N &lt;= 10^6<\/code><\/p>\n<p>  <b>Sample:<\/b><br \/>  <b>Input:<\/b> 2 \/ <b>Output:<\/b> 1 <br \/>  <b>Input:<\/b> 4 \/ <b>Output:<\/b> 1<\/p><\/blockquote>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0435\u0440\u0435\u0432\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\u041d\u0430 \u043f\u0440\u043e\u0442\u044f\u0436\u0435\u043d\u0438\u0438 \u0434\u043e\u043b\u0433\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0422\u043e\u043c \u0438 \u0414\u0436\u0435\u0440\u0440\u0438 \u0431\u043e\u0440\u043e\u043b\u0438\u0441\u044c \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c \u0437\u0430 \u043a\u0443\u0441\u043e\u043a \u0441\u044b\u0440\u0430. \u0412\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u043f\u043e\u043c\u043e\u0447\u044c \u0438\u043c \u0431\u044b\u0441\u0442\u0440\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043f\u043e\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u044f. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u0435\u0434\u0438\u043d\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0448\u0430\u0442\u044c\u0441\u044f \u0432 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0438\u0433\u0440\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e N <code>(1 &lt;= N &lt;= 10^6)<\/code>. \u0422\u043e\u043c \u0438 \u0414\u0436\u0435\u0440\u0440\u0438 \u0431\u0443\u0434\u0443\u0442 \u0438\u0433\u0440\u0430\u0442\u044c \u0432 \u0438\u0433\u0440\u0443 \u043f\u043e\u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e. \u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043d\u0438\u0445 \u0432\u044b\u0447\u0442\u0435\u0442 \u0447\u0438\u0441\u043b\u043e n <code>[n &lt; N]<\/code> \u0442\u0430\u043a, \u0447\u0442\u043e <code>N % n = 0<\/code>. <br \/>  \u0418\u0433\u0440\u0430 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442\u0441\u044f \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043e\u0434\u0438\u043d \u0438\u0437 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0445\u043e\u0434. \u0422\u043e\u0442, \u043a\u0442\u043e \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0445\u043e\u0434, \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u0442.<br \/>  \u0418\u0433\u0440\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0422\u043e\u043c \u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u0435\u0440\u0432\u044b\u0439 \u0445\u043e\u0434. \u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043e\u0431\u0430 \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u0445\u043e\u0434\u044b \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u0412\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043a\u0442\u043e \u043f\u043e\u0431\u0435\u0434\u0438\u0442 \u0432 \u0438\u0433\u0440\u0435.<\/p>\n<p>  <b>\u041d\u0430 \u0432\u0445\u043e\u0434 \u043f\u043e\u0434\u0430\u0435\u0442\u0441\u044f: <\/b>\u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0432\u0432\u043e\u0434\u0430 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0447\u0438\u0441\u043b\u0430 N.<br \/>  <b>\u0412\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430:<\/b> 1, \u0435\u0441\u043b\u0438 \u043f\u043e\u0431\u0435\u0434\u0438\u0442 \u0422\u043e\u043c; 0, \u0435\u0441\u043b\u0438 \u0414\u0436\u0435\u0440\u0440\u0438 \u0432\u044b\u0438\u0433\u0440\u0430\u0435\u0442. \u0412 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435.<\/p>\n<p>  <b>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f:<\/b><br \/>  <code>1 &lt;= N &lt;= 10 ^ 6<\/code><\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0440 <\/b><br \/>  <b>\u0412\u0432\u043e\u0434: <\/b> 2 \/ <b>\u0412\u044b\u0432\u043e\u0434:<\/b> 1<br \/>  <b>\u0412\u0432\u043e\u0434:<\/b> 4 \/ <b>\u0412\u044b\u0432\u043e\u0434:<\/b> 1  <\/div>\n<\/div>\n<p>  2. <b>N meetings in one room<\/b>  <\/p>\n<blockquote><p>There is one meeting room in a firm. There are N meetings in the form of <code>(S[i], F[i])<\/code> where S[i] is start time of meeting i and F[i] is finish time of meeting i.<br \/>  What is the maximum number of meetings that can be accommodated in the meeting room?<\/p>\n<p>  <b>Input:<\/b><br \/>  The first line of input consists number of the test cases. The description of T test cases is as follows:<br \/>  The first line consists of the size of the array, second line has the array containing the starting time of all the meetings each separated by a space, i.e., S [i]. And the third line has the array containing the finishing time of all the meetings each separated by a space, i.e., F [i].<br \/>  <b>Output:<\/b><br \/>  In each separate line print the order in which the meetings take place separated by a space.<\/p>\n<p>  <b>Constraints:<\/b><br \/>  <code>1 \u2264 T \u2264 70<br \/>  1 \u2264 N \u2264 100<br \/>  1 \u2264 S[ i ], F[ i ] \u2264 100000<\/code><\/p>\n<p>  <b>Example:<\/b><br \/>  <b>Input:<\/b><br \/>  <code>2<br \/>  6<br \/>  1 3 0 5 8 5<br \/>  2 4 6 7 9 9<br \/>  8<br \/>  75250 50074 43659 8931 11273 27545 50879 77924<br \/>  112960 114515 81825 93424 54316 35533 73383 160252 <\/code><br \/>  <b>Output:<\/b><br \/>  <code>1 2 4 5<br \/>  6 7 1<\/code><\/p><\/blockquote>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0435\u0440\u0435\u0432\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\u0412 \u0444\u0438\u0440\u043c\u0435 \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u0430 \u043f\u0435\u0440\u0435\u0433\u043e\u0432\u043e\u0440\u043d\u0430\u044f. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 N \u0432\u0441\u0442\u0440\u0435\u0447 \u0432 \u0444\u043e\u0440\u043c\u0435 <code>(S [i], F [i])<\/code>, \u0433\u0434\u0435 S [i] \u2014 \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0441\u0442\u0440\u0435\u0447\u0438 i, \u0430 F [i] \u2014 \u0432\u0440\u0435\u043c\u044f \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0432\u0441\u0442\u0440\u0435\u0447\u0438 i.<br \/>  \u0417\u0430\u0434\u0430\u0447\u0430 \u2014 \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0441\u0442\u0440\u0435\u0447 \u0432 \u043f\u0435\u0440\u0435\u0433\u043e\u0432\u043e\u0440\u043d\u043e\u0439.<\/p>\n<p>  <b>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:<\/b><br \/>  \u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0432\u0432\u043e\u0434\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u0441\u0442\u043e\u0432. \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u0435\u0441\u0442\u043e\u0432 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<br \/>  \u2022 \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430;<br \/>  \u2022 \u0432\u0442\u043e\u0440\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0438\u043c\u0435\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0441\u0435\u0445 \u0432\u0441\u0442\u0440\u0435\u0447 S[i], \u043a\u0430\u0436\u0434\u043e\u0435 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043e \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u043c;<br \/>  \u2022 \u0442\u0440\u0435\u0442\u044c\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u0430\u0441\u0441\u0438\u0432, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0432\u0440\u0435\u043c\u044f \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0432\u0441\u0442\u0440\u0435\u0447 F[i], \u043a\u0430\u0436\u0434\u043e\u0435 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043e \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u043c.<br \/>  <b>\u0412\u044b\u0432\u043e\u0434:<\/b><br \/>  \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0432\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u043f\u043e\u0440\u044f\u0434\u043e\u043a, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0442 \u0441\u043e\u0431\u0440\u0430\u043d\u0438\u044f, \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0431\u0435\u043b.<\/p>\n<p>  <b>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f:<\/b><br \/>  <code>1 \u2264 T \u2264 70<br \/>  1 \u2264 N \u2264 100<br \/>  1 \u2264 S [i], F [i] \u2264 100000<\/code><\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0440:<br \/>  \u0412\u0432\u043e\u0434:<\/b><br \/>  <code>2<br \/>  6<br \/>  1 3 0 5 8 5<br \/>  2 4 6 7 9 9<br \/>  8<br \/>  75250 50074 43659 8931 11273 27545 50879<br \/>  77924 112960 114515 81825 93424 54316 35533 73383 160252 <\/code><br \/>  <b>\u0412\u044b\u0445\u043e\u0434:<\/b><br \/>  <code>1 2 4 5<br \/>  6 7 1<\/code>  <\/div>\n<\/div>\n<p>  3. <b>Inversion of array<\/b>  <\/p>\n<blockquote><p>Given an array of positive integers. The task is to find inversion count of array.<br \/>  <b>Inversion Count:<\/b> For an array, inversion count indicates how far (or close) the array is from being sorted. If array is already sorted then inversion count is 0. If array is sorted in reverse order that inversion count is the maximum. <br \/>  Formally, two elements a[i] and a[j] form an inversion if <code>a[i] &gt; a[j]<\/code> and <code>i &lt; j<\/code>.<\/p>\n<p>  <b>Input:<\/b> The first line of input contains an integer T denoting the number of test cases. The first line of each test case is N, the size of array. The second line of each test case contains N elements.<br \/>  <b>Output:<\/b> Print the inversion count of array.<\/p>\n<p>  <b>Constraints:<\/b><br \/>  <code>1 \u2264 T \u2264 100<br \/>  1 \u2264 N \u2264 107<br \/>  1 \u2264 C \u2264 1018<\/code><\/p>\n<p>  <b>Example:<br \/>  Input:<\/b><br \/>  <code>1<br \/>  5<br \/>  2 4 1 3 5<\/code><br \/>  <b>Output:<\/b><br \/>  <code>3<\/code><\/p><\/blockquote>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0435\u0440\u0435\u0432\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\u0414\u0430\u043d \u043c\u0430\u0441\u0441\u0438\u0432 \u043d\u0430\u0442\u0443\u0440\u0430\u043b\u044c\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b. \u0417\u0430\u0434\u0430\u0447\u0430 \u2014 \u043d\u0430\u0439\u0442\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u043d\u0432\u0435\u0440\u0441\u0438\u0439 \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<br \/>  <b>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u043d\u0432\u0435\u0440\u0441\u0438\u0439:<\/b> \u0434\u043b\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u043d\u0432\u0435\u0440\u0441\u0438\u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0430\u043b\u0435\u043a\u043e (\u0438\u043b\u0438 \u0431\u043b\u0438\u0437\u043a\u043e) \u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0442 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438. \u0415\u0441\u043b\u0438 \u043c\u0430\u0441\u0441\u0438\u0432 \u0443\u0436\u0435 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d, \u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u043d\u0432\u0435\u0440\u0441\u0438\u0439 \u0440\u0430\u0432\u043d\u043e 0. \u0415\u0441\u043b\u0438 \u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u043d\u0432\u0435\u0440\u0441\u0438\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c. <br \/>  \u0424\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0434\u0432\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 a[i] \u0438 a[j] \u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442 \u0438\u043d\u0432\u0435\u0440\u0441\u0438\u044e, \u0435\u0441\u043b\u0438 <code>a[i] &gt; a[j]<\/code> \u0438 <code>i &lt; j<\/code>.<\/p>\n<p>  <b>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:<\/b><br \/>  \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e T, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u0441\u0442\u043e\u0432. \u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u2014 \u044d\u0442\u043e N, \u0440\u0430\u0437\u043c\u0435\u0440 \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u0412\u0442\u043e\u0440\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 N \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<br \/>  <b>\u0412\u044b\u0445\u043e\u0434:<\/b><br \/>  \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u043d\u0432\u0435\u0440\u0441\u0438\u0439 \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n<p>  <b>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f:<\/b><br \/>  <code>1 \u2264 T \u2264 100<br \/>  1 \u2264 N \u2264 10 7<br \/>  1 \u2264 C \u2264 10 18<\/code><\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0440:<br \/>  \u0412\u0432\u043e\u0434:<\/b><br \/>  <code>1<br \/>  5<br \/>  2 4 1 3 5<\/code><br \/>  <b>\u0412\u044b\u0445\u043e\u0434:<\/b><br \/>  3<\/div>\n<\/div>\n<p>  \u041e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0438 \u0431\u0443\u0434\u0443\u0442 \u0434\u0430\u043d\u044b \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043d\u0435\u0434\u0435\u043b\u0438 \u2014 \u0443\u0441\u043f\u0435\u0439\u0442\u0435 \u0440\u0435\u0448\u0438\u0442\u044c. \u0423\u0434\u0430\u0447\u0438!<\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d() } } }t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>      <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/spice\/blog\/477460\/\"> https:\/\/habr.com\/ru\/company\/spice\/blog\/477460\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/spice\/blog\/477460\/\">\u0421\u0440\u043e\u0447\u043d\u043e \u0432 \u043d\u043e\u043c\u0435\u0440! \u0412\u043e\u0437\u0440\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u0440\u0443\u0431\u0440\u0438\u043a\u0438 IT\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438. \u041c\u044b \u0432\u043d\u043e\u0432\u044c \u0441\u043e\u0431\u0440\u0430\u043b\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0438 \u0437\u0430\u0434\u0430\u0447\u0438, \u0437\u0430\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u043d\u0430 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f\u0445 \u0432 IT-\u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/dn\/i1\/sd\/dni1sdddswzqee4cijesuvw8rlo.png\" alt=\"image\"><\/p>\n<p>  \u0412\u044b\u043f\u0443\u0441\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043a\u0430\u0436\u0434\u0443\u044e \u043d\u0435\u0434\u0435\u043b\u044e \u2014 \u0441\u043b\u0435\u0434\u0438\u0442\u0435 \u0437\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438! \u0420\u0443\u0431\u0440\u0438\u043a\u0430 \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0435 \u0440\u0435\u043a\u0440\u0443\u0442\u0438\u043d\u0433\u043e\u0432\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442\u0441\u0442\u0432\u0430 <a href=\"http:\/\/www.spice-agency.ru\/ru\/\">Spice IT<\/a>.<\/p>\n<p>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0443 \u043d\u0430\u0441 \u0437\u0430\u0434\u0430\u0447\u0438 \u2014 \u043e\u0447\u0435\u043d\u044c \u0440\u0430\u0437\u043d\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u2014 \u0441 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439 \u0432 \u0438\u043d\u0434\u0438\u0439\u0441\u043a\u0443\u044e \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044e Flipkart. \u041d\u0443 \u0447\u0442\u043e, \u043f\u0440\u043e\u0448\u043b\u0438 \u0441\u043e\u0431\u0435\u0441? <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-295173","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/295173","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=295173"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/295173\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=295173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=295173"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=295173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}