{"id":303578,"date":"2020-05-14T15:00:12","date_gmt":"2020-05-14T15:00:12","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=303578"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=303578","title":{"rendered":"\u0412\u044b\u043f\u0443\u0441\u043a#38: 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 post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/spice\/blog\/501126\/\">\u041f\u0440\u0438\u0432\u0435\u0442! \u041d\u043e\u0432\u0430\u044f \u043d\u0435\u0434\u0435\u043b\u044f \u2014 \u043d\u043e\u0432\u044b\u0439 \u0432\u044b\u043f\u0443\u0441\u043a \u0431\u0440\u0435\u0439\u043d\u0442\u0438\u0437\u0438\u0440\u043e\u0432. \u041d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437, \u0441 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439 \u0432 \u0418\u0422-\u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044e Accolite. <br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/1v\/om\/3w\/1vom3wp4to7fimga4wpaa6hcgig.png\"><br \/>  \u041a\u0441\u0442\u0430\u0442\u0438, \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u043a\u0438 \u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u0432\u044b\u043f\u0443\u0441\u043a\u0430 \u0443\u0436\u0435 <a href=\"https:\/\/habr.com\/ru\/company\/spice\/blog\/499812\/\">\u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u044b<\/a>, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0439\u0442\u0435 \u0441\u0435\u0431\u044f \u0438 \u0441\u0432\u043e\u044e \u0441\u043c\u0435\u043a\u0430\u043b\u043a\u0443. <\/p>\n<p>  \u041d\u0443 \u0447\u0442\u043e, \u043f\u043e\u0433\u043d\u0430\u043b\u0438!<a name=\"habracut\"><\/a><\/p>\n<h2>\u0412\u043e\u043f\u0440\u043e\u0441\u044b<\/h2>\n<p>  1. <b>Rich or Poor<\/b>  <\/p>\n<blockquote><p>A place has two kinds of residents, Poor, who always tell the truth, and their opposites, Rich, who always lie. You encounter two people A and B. What are A and B if A says \u201cB is a Poor\u201d and B says \u201cThe two of us are opposite types\u201d?<\/p><\/blockquote>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u0435\u0440\u0435\u0432\u043e\u0434<\/b>                         <\/p>\n<div class=\"spoiler_text\">\u0412 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u043c\u0435\u0441\u0442 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0432\u0438\u0434\u0430 \u0436\u0438\u0442\u0435\u043b\u0435\u0439: \u0431\u0435\u0434\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0433\u043e\u0432\u043e\u0440\u044f\u0442 \u043f\u0440\u0430\u0432\u0434\u0443, \u0438 \u0431\u043e\u0433\u0430\u0442\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043b\u0433\u0443\u0442. \u0412\u044b \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u0442\u0435\u0441\u044c \u0441 \u0434\u0432\u0443\u043c\u044f \u043b\u044e\u0434\u044c\u043c\u0438 A \u0438 B. \u041a \u043a\u0430\u043a\u043e\u043c\u0443 \u0438\u0437 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043b\u044e\u0434\u0435\u0439 A \u0438 B, \u0435\u0441\u043b\u0438 A \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u00abB \u2014 \u0431\u0435\u0434\u043d\u044b\u0439\u00bb, \u0430 B \u0433\u043e\u0432\u043e\u0440\u0438\u0442: \u00ab\u041c\u044b \u043e\u0431\u0430 \u2014 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u044b\u0435 \u0442\u0438\u043f\u044b\u00bb?<\/div>\n<\/p><\/div>\n<p>  2. <b>Boy with Marbles<\/b>  <\/p>\n<blockquote><p>A boy goes to 20 of his friend\u2019s houses with \u2018n\u2019 number of newly purchased marbles in his hands. At every house he visits, he gives away half of marbles he have and take one of his friend\u2019s marble\u2019s and adds it with the one\u2019s he is left with, he never had a problem of dividing an odd number of marbles left and finally after leaving the his 20th friends house, he is left with 2 marbles, can you guess the \u2018n\u2019 value?<\/p><\/blockquote>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u0435\u0440\u0435\u0432\u043e\u0434<\/b>                         <\/p>\n<div class=\"spoiler_text\">\u041c\u0430\u043b\u044c\u0447\u0438\u043a \u0438\u0434\u0435\u0442 \u0432 20 \u0434\u043e\u043c\u043e\u0432 \u0441\u0432\u043e\u0438\u0445 \u0434\u0440\u0443\u0437\u0435\u0439 \u0441 \u00abn\u00bb \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u043a\u0443\u043f\u043b\u0435\u043d\u043d\u044b\u0445 \u0448\u0430\u0440\u0438\u043a\u043e\u0432 \u0432 \u0440\u0443\u043a\u0430\u0445. \u0412 \u043a\u0430\u0436\u0434\u043e\u043c \u0434\u043e\u043c\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043d \u043f\u043e\u0441\u0435\u0449\u0430\u0435\u0442, \u043e\u043d \u043e\u0442\u0434\u0430\u0435\u0442 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 \u0448\u0430\u0440\u0438\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443 \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c, \u0438 \u0431\u0435\u0440\u0435\u0442 \u043e\u0434\u0438\u043d \u0438\u0437 \u0448\u0430\u0440\u0438\u043a\u043e\u0432 \u0441\u0432\u043e\u0435\u0433\u043e \u0434\u0440\u0443\u0433\u0430 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0433\u043e \u043a \u0442\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443 \u043d\u0435\u0433\u043e \u043e\u0441\u0442\u0430\u043b\u0438\u0441\u044c. \u0423 \u043d\u0435\u0433\u043e \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u043d\u0435\u0447\u0435\u0442\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u0448\u0430\u0440\u0438\u043a\u043e\u0432, \u0438 \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043e\u043d \u043f\u043e\u043a\u0438\u043d\u0443\u043b \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0434\u043e\u043c \u0441\u0432\u043e\u0438\u0445 20 \u0434\u0440\u0443\u0437\u0435\u0439, \u0443 \u043d\u0435\u0433\u043e \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c 2 \u0448\u0430\u0440\u0438\u043a\u0430. \u041c\u043e\u0436\u0435\u0442\u0435 \u043b\u0438 \u0432\u044b \u0443\u0433\u0430\u0434\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u00abn\u00bb?<\/div>\n<\/p><\/div>\n<p>  <\/p>\n<h2>\u0417\u0430\u0434\u0430\u0447\u0438<\/h2>\n<p>  1. <b>Swap two nibbles in a byte<\/b>  <\/p>\n<blockquote><p>Given a byte, swap the two nibbles in it. For example 100 is be represented as 01100100 in a byte (or 8 bits). The two nibbles are (0110) and (0100). If we swap the two nibbles, we get 01000110 which is 70 in decimal.<\/p>\n<p>  <b>Input:<\/b><br \/>  The first line contains &#8216;T&#8217; denoting the number of testcases. Each testcase contains a single positive integer X.<\/p>\n<p>  <b>Output:<\/b><br \/>  In each separate line print the result after swapping the nibbles.<\/p>\n<p>  <b>Constraints:<\/b><br \/>  <code>1 \u2264 T \u2264 70<br \/>  1 \u2264 X \u2264 255<\/code><\/p>\n<p>  <b>Example:<br \/>  Input:<\/b><br \/>  <code>2<br \/>  100<br \/>  129<\/code><\/p>\n<p>  <b>Output:<\/b><br \/>  <code>70<br \/>  24<\/code><\/p><\/blockquote>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u0435\u0440\u0435\u0432\u043e\u0434<\/b>                         <\/p>\n<div class=\"spoiler_text\">\u0414\u0430\u043d \u0431\u0430\u0439\u0442, \u043f\u043e\u043c\u0435\u043d\u044f\u0439\u0442\u0435 \u043c\u0435\u0441\u0442\u0430\u043c\u0438 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438 \u0432 \u043d\u0435\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 100 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u0430\u043a 01100100 \u0432 \u0431\u0430\u0439\u0442\u0435 (\u0438\u043b\u0438 8 \u0431\u0438\u0442\u0430\u0445). \u0414\u0432\u0435 \u0447\u0430\u0441\u0442\u0438 \u2014 \u044d\u0442\u043e (0110) \u0438 (0100). \u0415\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u043c\u0435\u043d\u044f\u0435\u043c \u043c\u0435\u0441\u0442\u0430\u043c\u0438 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c 01000110, \u0447\u0442\u043e \u0440\u0430\u0432\u043d\u043e 70 \u0432 \u0434\u0435\u0441\u044f\u0442\u0438\u0447\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0441\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f.<\/p>\n<p>  <b>\u0412\u0432\u043e\u0434:<\/b><br \/>  \u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0431\u0443\u043a\u0432\u0443 \u00ab\u0422\u00bb, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0443\u044e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u0441\u0442\u043e\u0432. \u041a\u0430\u0436\u0434\u044b\u0439 \u0442\u0435\u0441\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0434\u043d\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e X.<\/p>\n<p>  <b>\u0412\u044b\u0432\u043e\u0434:<\/b><br \/>  \u0412 \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 \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043c\u0435\u043d\u044b \u0447\u0430\u0441\u0442\u0435\u0439.<\/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 X \u2264 255<\/code><\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0440:<br \/>  \u0412\u0432\u043e\u0434:<\/b><br \/>  <code>2<br \/>  100<br \/>  129<\/code><\/p>\n<p>  <b>\u0412\u044b\u0432\u043e\u0434:<\/b><br \/>  <code>70<br \/>  24<\/code><\/div>\n<\/p><\/div>\n<p>  2. <b>Count pairs with given sum<\/b>  <\/p>\n<blockquote><p>Given an array of integers, and an integer \u2018K\u2019, find the count of pairs of elements in the array whose sum is equal to &#8216;K&#8217;.<\/p>\n<p>  <b>Input:<\/b><br \/>  First line of the input contains an integer T, denoting the number of test cases. Then T test cases follow. Each test case consists of two lines. First line of each test case contains 2 space separated integers N and K denoting the size of array and the sum respectively. Second line of each test case contains N space separated integers denoting the elements of the array.<\/p>\n<p>  <b>Output:<\/b><br \/>  Print the count of pairs of elements in the array whose sum is equal to the K.<\/p>\n<p>  <b>Constraints:<\/b><br \/>  <code>1&lt;=T&lt;=50<br \/>  1&lt;=N&lt;=50<br \/>  1&lt;=K&lt;=50<br \/>  1&lt;=A[i]&lt;=100<\/code><\/p>\n<p>  <b>Example:<br \/>  Input<\/b><br \/>  <code>2<br \/>  4 6<br \/>  1 5 7 1<br \/>  4 2<br \/>  1 1 1 1<\/code><br \/>  <b>Output<\/b><br \/>  <code>2<br \/>  6<\/code><\/p><\/blockquote>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <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 \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0438 \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u00abK\u00bb, \u043d\u0430\u0439\u0434\u0438\u0442\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0430\u0440 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435, \u0441\u0443\u043c\u043c\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0432\u043d\u0430 \u00abK\u00bb.<\/p>\n<p>  <b>\u0412\u0432\u043e\u0434:<\/b><br \/>  \u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \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. \u0417\u0430\u0442\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0442 T \u0442\u0435\u0441\u0442\u043e\u0432. \u041a\u0430\u0436\u0434\u044b\u0439 \u0442\u0435\u0441\u0442 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0441\u0442\u0440\u043e\u043a. \u041f\u0435\u0440\u0432\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 2 \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u043b\u0430 N \u0438 K, \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u0435\u043b\u0430\u043c\u0438, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0438\u0445 \u0440\u0430\u0437\u043c\u0435\u0440 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0438 \u0441\u0443\u043c\u043c\u0443 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. \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 \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u043c, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n<p>  <b>\u0412\u044b\u0432\u043e\u0434:<\/b><br \/>  \u0412\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0430\u0440 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435, \u0441\u0443\u043c\u043c\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0432\u043d\u0430 \u041a.<\/p>\n<p>  <b>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f:<\/b><br \/>  <code>1&lt; = T&lt; = 50<br \/>  1&lt; = N&lt; = 50<br \/>  1&lt; = K&lt; = 50<br \/>  1&lt;=A[i]&lt; = 100<\/code><\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0440:<br \/>  \u0412\u0432\u043e\u0434<\/b><br \/>  <code>2<br \/>  4 6<br \/>  1 5 7 1<br \/>  4 2<br \/>  1 1 1 1<\/code><br \/>  <b>\u0412\u044b\u0432\u043e\u0434<\/b><br \/>  <code>2<br \/>  6<\/code><\/div>\n<\/p><\/div>\n<p>  3. <b>Trie | (Insert and Search)<\/b>  <\/p>\n<blockquote><p>Trie is an efficient information retrieval data structure. Use this data structure to store Strings and search strings. Your task is to use TRIE data structure and search the given string A. If found print 1 else 0.<\/p>\n<p>  <b>Input:<\/b><br \/>  The first line of input contains a single integer T denoting the number of test cases. Then T test cases follow. Each test case consists of three lines.<br \/>  First line of each test case consist of a integer N, denoting the number of element in a Trie to be stored.<br \/>  Second line of each test case consists of N space separated strings denoting the elements to be stored in the trie.<br \/>  Third line of each test case consists of a String A to be searched in the stored elements.<\/p>\n<p>  <b>Output:<\/b><br \/>  Print the respective output in the respective line.<\/p>\n<p>  <b>Constraints:<\/b><br \/>  <code>1&lt;=T&lt;=20<br \/>  1&lt;=N&lt;=20<\/code><\/p>\n<p>  <b>Example:<br \/>  Input:<\/b><br \/>  <code>1<br \/>  8<br \/>  the a there answer any by bye their<br \/>  the<\/code><br \/>  <b>Output:<\/b><br \/>  <code>1<\/code><\/p><\/blockquote>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u0435\u0440\u0435\u0432\u043e\u0434<\/b>                         <\/p>\n<div class=\"spoiler_text\">Trie \u2014 \u044d\u0442\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u044d\u0442\u0443 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a \u0438 \u043f\u043e\u0438\u0441\u043a\u0430 \u0441\u0442\u0440\u043e\u043a. \u0412\u0430\u0448\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 TRIE \u0438 \u0438\u0441\u043a\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 A. \u0415\u0441\u043b\u0438 \u043e\u043d\u0430 \u043d\u0430\u0439\u0434\u0435\u043d\u0430, \u0432\u044b\u0432\u0435\u0434\u0438\u0442\u0435 1, \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u2014 0.<\/p>\n<p>  <b>\u0412\u0432\u043e\u0434:<\/b><br \/>  \u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0434\u043d\u043e \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. \u0417\u0430\u0442\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0442 T \u0442\u0435\u0441\u0442\u043e\u0432. \u041a\u0430\u0436\u0434\u044b\u0439 \u0442\u0435\u0441\u0442 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0442\u0440\u0435\u0445 \u0441\u0442\u0440\u043e\u043a.<br \/>  \u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0446\u0435\u043b\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 N, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0435\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 TRIE, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u044b.<br \/>  \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\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 N \u0441\u0442\u0440\u043e\u043a, \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u0435\u043b\u0430\u043c\u0438, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0432 TRIE.<br \/>  \u0422\u0440\u0435\u0442\u044c\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438 A, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043a\u0430\u0442\u044c \u0432 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0445.<\/p>\n<p>  <b>\u0412\u044b\u0432\u043e\u0434:<\/b><br \/>  \u0412\u044b\u0432\u0435\u0434\u0438\u0442\u0435 1 \u0438\u043b\u0438 0 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\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; = T&lt; = 20<br \/>  1&lt; = N&lt; = 20<\/code><\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0440:<br \/>  \u0412\u0432\u043e\u0434:<\/b><br \/>  <code>1<br \/>  8<br \/>  the a there answer any by bye their<br \/>  the<\/code><br \/>  <b>\u0412\u044b\u0432\u043e\u0434:<\/b><br \/>  <code>1<\/code><\/div>\n<\/p><\/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> \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\/501126\/\"> https:\/\/habr.com\/ru\/company\/spice\/blog\/501126\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/spice\/blog\/501126\/\">\u041f\u0440\u0438\u0432\u0435\u0442! \u041d\u043e\u0432\u0430\u044f \u043d\u0435\u0434\u0435\u043b\u044f \u2014 \u043d\u043e\u0432\u044b\u0439 \u0432\u044b\u043f\u0443\u0441\u043a \u0431\u0440\u0435\u0439\u043d\u0442\u0438\u0437\u0438\u0440\u043e\u0432. \u041d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437, \u0441 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439 \u0432 \u0418\u0422-\u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044e Accolite. <br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/1v\/om\/3w\/1vom3wp4to7fimga4wpaa6hcgig.png\"><br \/>  \u041a\u0441\u0442\u0430\u0442\u0438, \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u043a\u0438 \u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u0432\u044b\u043f\u0443\u0441\u043a\u0430 \u0443\u0436\u0435 <a href=\"https:\/\/habr.com\/ru\/company\/spice\/blog\/499812\/\">\u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u044b<\/a>, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0439\u0442\u0435 \u0441\u0435\u0431\u044f \u0438 \u0441\u0432\u043e\u044e \u0441\u043c\u0435\u043a\u0430\u043b\u043a\u0443. <\/p>\n<p>  \u041d\u0443 \u0447\u0442\u043e, \u043f\u043e\u0433\u043d\u0430\u043b\u0438!<\/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-303578","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/303578","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=303578"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/303578\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=303578"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=303578"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=303578"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}