{"id":301766,"date":"2020-04-13T15:00:32","date_gmt":"2020-04-13T15:00:32","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=301766"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=301766","title":{"rendered":"\u0412\u044b\u043f\u0443\u0441\u043a#35: 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\/496654\/\">\u041f\u0440\u0438\u0432\u0435\u0442-\u043f\u0440\u0438\u0432\u0435\u0442! \u041c\u044b \u0432\u043d\u043e\u0432\u044c \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438 \u0412\u0430\u043c \u043f\u043e\u0434\u0431\u043e\u0440\u043a\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u0437\u0430\u0434\u0430\u0447\u0435\u043a \u0441 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439 \u0432 \u0432\u0435\u0434\u0443\u0449\u0438\u0435 IT-\u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438! <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/jj\/-x\/hn\/jj-xhngaw4gvgj4qiek4ot3wyzi.png\"><br \/>  \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>  \u041d\u0430 \u044d\u0442\u043e\u0439 \u043d\u0435\u0434\u0435\u043b\u0435 \u043c\u044b \u0441\u043e\u0431\u0440\u0430\u043b\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439 \u0432 \u0430\u043c\u0435\u0440\u0438\u043a\u0430\u043d\u0441\u043a\u0443\u044e \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044e PayPal. \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\/494310\/\">\u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u044b<\/a>.<a name=\"habracut\"><\/a><\/p>\n<h2>\u0412\u043e\u043f\u0440\u043e\u0441\u044b<\/h2>\n<p>  1. <b>Prisoner and Policeman Puzzle<\/b>  <\/p>\n<blockquote><p>Policeman decided to punish the Prisoner and asked him to make a statement. The Prisoner should make such a statement so that he would be alive.<br \/>  If the statement is held true by Policeman, the Prisoner will be hanged to death and if the statement is held false, the Prisoner will be shot dead.<\/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\">\u041f\u043e\u043b\u0438\u0446\u0435\u0439\u0441\u043a\u0438\u0439 \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043a\u0430\u0437\u0430\u0442\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0438 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043b \u0435\u0433\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u0438\u0435. \u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0435 \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u043e\u0441\u0442\u0430\u0442\u044c\u0441\u044f \u0432 \u0436\u0438\u0432\u044b\u0445.<br \/>  \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0437\u043d\u0430\u043d\u043e \u043f\u043e\u043b\u0438\u0446\u0435\u0439\u0441\u043a\u0438\u043c \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0434\u0430, \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0432\u0435\u0448\u0435\u043d, \u0430 \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0437\u043d\u0430\u043d\u043e \u043b\u043e\u0436\u043d\u044b\u043c, \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0441\u0442\u0440\u0435\u043b\u0435\u043d. \u041a\u0430\u043a\u043e\u0435 \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u043c\u0443?<\/div>\n<\/div>\n<p>  2. <b>Matchstick Puzzle<\/b>  <\/p>\n<blockquote><p>How to make 4 equilateral triangles with 6 identical match sticks?<\/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\">\u041a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c 4 \u0440\u0430\u0432\u043d\u043e\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u0438\u0437 6 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0441\u043f\u0438\u0447\u0435\u0447\u043d\u044b\u0445 \u043f\u0430\u043b\u043e\u0447\u0435\u043a?<\/div>\n<\/div>\n<p>  <\/p>\n<h2>\u0417\u0430\u0434\u0430\u0447\u0438<\/h2>\n<p>  1. <b>Intersection of two arrays<\/b>  <\/p>\n<blockquote><p>Given two arrays <b>A<\/b> and <b>B<\/b> respectively of size <b>N<\/b> and <b>M<\/b>. The task is to print the count of elements in the intersection (or common elements) of the two arrays.<br \/>  For this question, intersection of two arrays can be defined as the set containing distinct common elements between the two arrays.<\/p>\n<p>  <b>Input:<\/b><br \/>  The first line of input contains an integer T denoting the number of test cases. The first line of each test case is N and M, N is the size of array A and M is size of array B. The second line of each test case contains N input A[i].<br \/>  The third line of each test case contains M input B[i].<\/p>\n<p>  <b>Output:<\/b><br \/>  Print the count of intersecting elements.<\/p>\n<p>  <b>Constraints:<\/b><br \/>  <code>1 \u2264 T \u2264 100<br \/>  1 \u2264 N, M \u2264 105<br \/>  1 \u2264 A[i], B[i] \u2264 105<\/code><\/p>\n<p>  <b>Example:<br \/>  Input:<\/b><br \/>  <code>4<br \/>  5 3<br \/>  89 24 75 11 23<br \/>  89 2 4<br \/>  6 5<br \/>  1 2 3 4 5 6<br \/>  3 4 5 6 7<br \/>  4 4<br \/>  10 10 10 10<br \/>  20 20 20 20<br \/>  3 3<br \/>  10 10 10<br \/>  10 10 10<\/code><br \/>  <b>Output:<\/b><br \/>  <code>1<br \/>  4<br \/>  0<br \/>  1<\/code><\/p>\n<p>  <b>Explanation:<\/b><br \/>  <b>Testcase 1:<\/b> 89 is the only element in the intersection of two arrays.<br \/>  <b>Testcase 2:<\/b> 3 4 5 and 6 are the elements in the intersection of two arrays.<br \/>  <b>Testcase 3:<\/b> Non of the elements are common so the output will be -1.<br \/>  <b>Testcase 4:<\/b> 10 is the only element which is in the intersection of two arrays.<\/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\u044b \u0434\u0432\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <b>A<\/b> \u0438 <b>B<\/b> \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 <b>N<\/b> \u0438 <b>M<\/b>. \u0417\u0430\u0434\u0430\u0447\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0438 (\u0438\u043b\u0438 \u043e\u0431\u0449\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0445) \u0434\u0432\u0443\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432.<br \/>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0434\u0432\u0443\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043a\u0430\u043a \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043e\u0431\u0449\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438.<\/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. \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 \u0438 M, N-\u0440\u0430\u0437\u043c\u0435\u0440 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 A, \u0430 M-\u0440\u0430\u0437\u043c\u0435\u0440 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 B. \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 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 A[i].<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\u0434\u0435\u0440\u0436\u0438\u0442 M \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 B[i].<\/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\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<\/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, M \u2264 105<br \/>  1 \u2264 A[i], B[i] \u2264 105<\/code><\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0440:<br \/>  \u0412\u0432\u043e\u0434:<\/b><br \/>  <code>4<br \/>  5 3<br \/>  89 24 75 11 23<br \/>  89 2 4<br \/>  6 5<br \/>  1 2 3 4 5 6<br \/>  3 4 5 6 7<br \/>  4 4<br \/>  10 10 10 10<br \/>  20 20 20 20<br \/>  3 3<br \/>  10 10 10<br \/>  10 10 10<\/code><br \/>  <b>\u0412\u044b\u0432\u043e\u0434:<\/b><br \/>  <code>1<br \/>  4<br \/>  0<br \/>  1<\/code><\/p>\n<p>  <b>\u041e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435:<\/b><br \/>  \u0422\u0435\u0441\u0442 1: 89 \u2014 \u044d\u0442\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0438 \u0434\u0432\u0443\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432.<br \/>  \u0422\u0435\u0441\u0442 2: 3 4 5 \u0438 6 \u2014 \u044d\u0442\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0438 \u0434\u0432\u0443\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432.<br \/>  \u0422\u0435\u0441\u0442 3: \u043d\u0435\u0442 \u043e\u0431\u0449\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b\u0432\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u0435\u043d 0.<br \/>  \u0422\u0435\u0441\u0442 4: 10 \u2014 \u044d\u0442\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0438 \u0434\u0432\u0443\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432.<\/div>\n<\/div>\n<p>  2. <b>Concatenation of Zig-Zag String in \u2018n\u2019 Rows<\/b>  <\/p>\n<blockquote><p>Given a string and number of rows \u2018n\u2019. Print the string formed by concatenating n rows when input string is written in row-wise Zig-Zag fashion.<\/p>\n<p>  <b>Examples:<\/b><br \/>  <code>Input:<br \/>  str = &quot;ABCDEFGH&quot;<br \/>  n = 2<br \/>  Output: &quot;ACEGBDFH&quot;<br \/>  Explanation: Let us write input string in Zig-Zag fashion in 2 rows.<br \/>  A___C___E___G <br \/>  __B___D___F___H<br \/>  Now concatenate the two rows and ignore spaces <br \/>  in every row. We get &quot;ACEGBDFH&quot;<\/p>\n<p>  Input:<br \/>  str = &quot;SPICEITRECRUITMENT&quot;<br \/>  n = 3<br \/>  Output: SEEINPCIRCUTETITRM<br \/>  Explanation: Let us write input string in Zig-Zag fashion in 3 rows.<br \/>  S_______E_______E_______I_______N<br \/>  __P___C___I___R___C___U___T___E___T<br \/>  ____I_______T_______R_______M<br \/>  Now concatenate the two rows and ignore spaces <br \/>  in every row. We get &quot;SEEINPCIRCUTETITRM&quot;<\/code><\/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 of each test case contains the string, and the second line has &#8216;n&#8217; the number of rows.<\/p>\n<p>  <b>Output:<\/b><br \/>  In each separate line print the string after concatenating n rows in a zig zag form.<\/p>\n<p>  <b>Constraints:<\/b><br \/>  <code>1 \u2264 T \u2264 70<br \/>  1 \u2264 N \u2264 size of string<\/code><\/p>\n<p>  <b>Example:<br \/>  Input:<\/b><br \/>  <code>2<br \/>  qrrc<br \/>  3<br \/>  rfkqyuqfjkxy<br \/>  2<\/code><br \/>  <b>Output:<\/b><br \/>  <code>qrcr<br \/>  rkyqjxfqufky<\/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\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u043e\u043a \u2018n&#8217;. \u0412\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u0441\u0442\u0440\u043e\u043a\u0443, \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043f\u0443\u0442\u0435\u043c \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f n \u0441\u0442\u0440\u043e\u043a, \u043a\u043e\u0433\u0434\u0430 \u0432\u0445\u043e\u0434\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u0438\u0433\u0437\u0430\u0433\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u043e \u043f\u043e \u0441\u0442\u0440\u043e\u043a\u0430\u043c.<\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0440\u044b:<\/b><br \/>  <code>\u0412\u0432\u043e\u0434:<br \/>  str = &quot;ABCDEFGH&quot;<br \/>  n = 2<br \/>  \u0412\u044b\u0432\u043e\u0434: &quot;ACEGBDFH&quot;<br \/>  \u041f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u0435: \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0432\u0445\u043e\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0437\u0438\u0433\u0437\u0430\u0433\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u043e \u0432 2 \u0441\u0442\u0440\u043e\u043a\u0438.<br \/>  A___C___E___G <br \/>  __B___D___F___H<br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u0435 \u044d\u0442\u0438 \u0434\u0432\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0438 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0439\u0442\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u044b \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0440\u044f\u0434\u0443. \u041c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c &quot;ACEGBDFH&quot;<\/p>\n<p>  \u0412\u0432\u043e\u0434: SEEINPCIRCUTETITRM<br \/>  str = &quot;SPICEITRECRUITMENT&quot;<br \/>  n = 3<br \/>  \u0412\u044b\u0432\u043e\u0434:<br \/>  \u041f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u0435: \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0432\u0445\u043e\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0437\u0438\u0433\u0437\u0430\u0433\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u043e \u0432 3 \u0441\u0442\u0440\u043e\u043a\u0438.<br \/>  S_______E_______E_______I_______N<br \/>  __P___C___I___R___C___U___T___E___T<br \/>  ____I_______T_______R_______M<br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u0435 \u044d\u0442\u0438 \u0434\u0432\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0438 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0439\u0442\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u044b \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0440\u044f\u0434\u0443. \u041c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c &quot;SEEINPCIRCUTETITRM&quot;<\/code><\/p>\n<p>  <b>\u0412\u0432\u043e\u0434:<\/b><br \/>  \u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0432\u0432\u043e\u0434\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0447\u0438\u0441\u043b\u0430 \u0442\u0435\u0441\u0442\u043e\u0432. \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u0435\u0441\u0442\u043e\u0432 t \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<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\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u0442\u0440\u043e\u043a\u0443, \u0430 \u0432\u0442\u043e\u0440\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 &#8216;n&#8217; \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u043e\u043a.<\/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 \u0441\u0442\u0440\u043e\u043a\u0443 \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f n \u0441\u0442\u0440\u043e\u043a \u0432 \u0432\u0438\u0434\u0435 \u0437\u0438\u0433\u0437\u0430\u0433\u0430.<\/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 \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u0442\u0440\u043e\u043a\u0438<\/code><\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0440:<br \/>  \u0412\u0432\u043e\u0434:<\/b><br \/>  <code>2<br \/>  qrrc<br \/>  3<br \/>  rfkqyuqfjkxy<br \/>  2<\/code><br \/>  <b>\u0412\u044b\u0432\u043e\u0434:<\/b><br \/>  <code>qrcr<br \/>  rkyqjxfqufky<\/code><\/div>\n<\/div>\n<p>  3. <b>Solve the Sudoku<\/b>  <\/p>\n<blockquote><p>Given an incomplete Sudoku configuration in terms of a 9 x 9 2-D square matrix (mat[][]). The task to print a solved Sudoku. For simplicity you may assume that there will be only one unique solution.<\/p>\n<p>  <b>Sample Sudoku for you to get the logic for its solution:<\/b><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/vv\/ay\/ur\/vvayur8htlc-0rz65bzeufpkwl4.png\"><\/p>\n<p>  <b>Input:<\/b><br \/>  The first line of input contains an integer T denoting the no of test cases. Then T test cases follow. Each test case contains 9*9 space separated values of the matrix mat[][] representing an incomplete Sudoku state where a 0 represents empty block.<\/p>\n<p>  <b>Output:<\/b><br \/>  For each test case, in a new line, print the space separated values of the solution of the the sudoku.<\/p>\n<p>  <b>Constraints:<\/b><br \/>  <code>1 &lt;= T &lt;= 10<br \/>  0 &lt;= mat[] &lt;= 9<\/code><\/p>\n<p>  <b>Example:<br \/>  Input:<\/b><br \/>  <code>1<br \/>  3 0 6 5 0 8 4 0 0<br \/>  5 2 0 0 0 0 0 0 0<br \/>  0 8 7 0 0 0 0 3 1<br \/>  0 0 3 0 1 0 0 8 0<br \/>  9 0 0 8 6 3 0 0 5<br \/>  0 5 0 0 9 0 6 0 0<br \/>  1 3 0 0 0 0 2 5 0<br \/>  0 0 0 0 0 0 0 7 4<br \/>  0 0 5 2 0 6 3 0 0<\/code><\/p>\n<p>  <b>Output:<\/b><br \/>  <code>3 1 6 5 7 8 4 9 2 5 2 9 1 3 4 7 6 8 4 8 7 6 2 9 5 3 1 2 6 3 4 1 5 9 8 7 9 7 4 8 6 3 1 2 5 8 5 1 7 9 2 6 4 3 1 3 8 9 4 7 2 5 6 6 9 2 3 5 1 8 7 4 7 4 5 2 8 6 3 1 9<\/code><\/p>\n<p>  <b>Explanation:<\/b><br \/>  <b>Testcase 1:<\/b> The solved sudoku is:<br \/>  <code>3 1 6 5 7 8 4 9 2<br \/>  5 2 9 1 3 4 7 6 8<br \/>  4 8 7 6 2 9 5 3 1<br \/>  2 6 3 4 1 5 9 8 7<br \/>  9 7 4 8 6 3 1 2 5<br \/>  8 5 1 7 9 2 6 4 3<br \/>  1 3 8 9 4 7 2 5 6<br \/>  6 9 2 3 5 1 8 7 4<br \/>  7 4 5 2 8 6 3 1 9<\/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\u0430 \u043d\u0435\u043f\u043e\u043b\u043d\u0430\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0441\u0443\u0434\u043e\u043a\u0443 \u0432 \u0432\u0438\u0434\u0435 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 9 x 9 2D (mat [] []). \u0417\u0430\u0434\u0430\u0447\u0430 \u0440\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u043d\u043e\u0435 \u0441\u0443\u0434\u043e\u043a\u0443. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u0443\u0434\u043e\u043a\u0443 \u0434\u043b\u044f \u0432\u0430\u0441, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u0434\u043b\u044f \u0435\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/vv\/ay\/ur\/vvayur8htlc-0rz65bzeufpkwl4.png\"><\/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\u0434\u0435\u0440\u0436\u0438\u0442 9 * 9 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u0435\u043b\u0430\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b mat [] [], \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0433\u043e \u043d\u0435\u043f\u043e\u043b\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u0443\u0434\u043e\u043a\u0443, \u0433\u0434\u0435 0 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043f\u0443\u0441\u0442\u043e\u0439 \u0431\u043b\u043e\u043a.<\/p>\n<p>  <b>\u0412\u044b\u0432\u043e\u0434:<\/b><br \/>  \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u0432 \u043d\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0432\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0431\u0435\u043b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u0443\u0434\u043e\u043a\u0443.<\/p>\n<p>  <b>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f:<\/b><br \/>  <code>1 &lt;= T &lt;= 10<br \/>  0 &lt;= mat[] &lt;= 9<\/code><\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0440:<br \/>  \u0412\u0432\u043e\u0434:<\/b><br \/>  <code>1<br \/>  3 0 6 5 0 8 4 0 0<br \/>  5 2 0 0 0 0 0 0 0<br \/>  0 8 7 0 0 0 0 3 1<br \/>  0 0 3 0 1 0 0 8 0<br \/>  9 0 0 8 6 3 0 0 5<br \/>  0 5 0 0 9 0 6 0 0<br \/>  1 3 0 0 0 0 2 5 0<br \/>  0 0 0 0 0 0 0 7 4<br \/>  0 0 5 2 0 6 3 0 0<\/code><\/p>\n<p>  <b>\u0412\u044b\u0432\u043e\u0434:<\/b><br \/>  <code>3 1 6 5 7 8 4 9 2 5 2 9 1 3 4 7 6 8 4 8 7 6 2 9 5 3 1 2 6 3 4 1 5 9 8 7 9 7 4 8 6 3 1 2 5 8 5 1 7 9 2 6 4 3 1 3 8 9 4 7 2 5 6 6 9 2 3 5 1 8 7 4 7 4 5 2 8 6 3 1 9<\/code><\/p>\n<p>  <b>\u041e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435:<\/b><br \/>  <b>\u041f\u0440\u0438\u043c\u0435\u0440 1:<\/b> \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u0441\u0443\u0434\u043e\u043a\u0443:<br \/>  <code>3 1 6 5 7 8 4 9 2<br \/>  5 2 9 1 3 4 7 6 8<br \/>  4 8 7 6 2 9 5 3 1<br \/>  2 6 3 4 1 5 9 8 7<br \/>  9 7 4 8 6 3 1 2 5<br \/>  8 5 1 7 9 2 6 4 3<br \/>  1 3 8 9 4 7 2 5 6<br \/>  6 9 2 3 5 1 8 7 4<br \/>  7 4 5 2 8 6 3 1 9<\/code><\/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> \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\/496654\/\"> https:\/\/habr.com\/ru\/company\/spice\/blog\/496654\/<\/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\/496654\/\">\u041f\u0440\u0438\u0432\u0435\u0442-\u043f\u0440\u0438\u0432\u0435\u0442! \u041c\u044b \u0432\u043d\u043e\u0432\u044c \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438 \u0412\u0430\u043c \u043f\u043e\u0434\u0431\u043e\u0440\u043a\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u0437\u0430\u0434\u0430\u0447\u0435\u043a \u0441 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439 \u0432 \u0432\u0435\u0434\u0443\u0449\u0438\u0435 IT-\u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438! <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/jj\/-x\/hn\/jj-xhngaw4gvgj4qiek4ot3wyzi.png\"><br \/>  \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>  \u041d\u0430 \u044d\u0442\u043e\u0439 \u043d\u0435\u0434\u0435\u043b\u0435 \u043c\u044b \u0441\u043e\u0431\u0440\u0430\u043b\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439 \u0432 \u0430\u043c\u0435\u0440\u0438\u043a\u0430\u043d\u0441\u043a\u0443\u044e \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044e PayPal. \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\/494310\/\">\u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u044b<\/a>.<\/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-301766","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/301766","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=301766"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/301766\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=301766"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=301766"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=301766"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}