<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.universitas.ro/index.php?action=history&amp;feed=atom&amp;title=1486_-_Gropi</id>
	<title>1486 - Gropi - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.universitas.ro/index.php?action=history&amp;feed=atom&amp;title=1486_-_Gropi"/>
	<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=1486_-_Gropi&amp;action=history"/>
	<updated>2026-05-01T10:58:13Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://wiki.universitas.ro/index.php?title=1486_-_Gropi&amp;diff=8627&amp;oldid=prev</id>
		<title>Vasiliu Costel Andrei at 21:52, 28 December 2023</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=1486_-_Gropi&amp;diff=8627&amp;oldid=prev"/>
		<updated>2023-12-28T21:52:19Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 21:52, 28 December 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l61&quot;&gt;Line 61:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 61:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;def numar_gropi_directie(harta, directie, x, y):&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;def numar_gropi_directie(harta, directie, x, y):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     directii = {&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     directii = {&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         &#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;n&lt;/del&gt;&#039;: (-1, 0),&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         &#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;N&lt;/ins&gt;&#039;: (-1, 0),&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         &#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;nE&lt;/del&gt;&#039;: (-1, 1),&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         &#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;NE&lt;/ins&gt;&#039;: (-1, 1),&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         &amp;#039;E&amp;#039;: (0, 1),&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         &amp;#039;E&amp;#039;: (0, 1),&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         &amp;#039;SE&amp;#039;: (1, 1),&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         &amp;#039;SE&amp;#039;: (1, 1),&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l68&quot;&gt;Line 68:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 68:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         &amp;#039;SV&amp;#039;: (1, -1),&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         &amp;#039;SV&amp;#039;: (1, -1),&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         &amp;#039;V&amp;#039;: (0, -1),&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         &amp;#039;V&amp;#039;: (0, -1),&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         &#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;nV&lt;/del&gt;&#039;: (-1, -1)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         &#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;NV&lt;/ins&gt;&#039;: (-1, -1)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l83&quot;&gt;Line 83:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 83:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;def determina_directie_maxima(x, y, harta):&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;def determina_directie_maxima(x, y, harta):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     directii = [&#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;n&lt;/del&gt;&#039;, &#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;nE&lt;/del&gt;&#039;, &#039;E&#039;, &#039;SE&#039;, &#039;S&#039;, &#039;SV&#039;, &#039;V&#039;, &#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;nV&lt;/del&gt;&#039;]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     directii = [&#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;N&lt;/ins&gt;&#039;, &#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;NE&lt;/ins&gt;&#039;, &#039;E&#039;, &#039;SE&#039;, &#039;S&#039;, &#039;SV&#039;, &#039;V&#039;, &#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;NV&lt;/ins&gt;&#039;]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     max_gropi = -1&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     max_gropi = -1&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     directie_maxima = None&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     directie_maxima = None&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Vasiliu Costel Andrei</name></author>
	</entry>
	<entry>
		<id>https://wiki.universitas.ro/index.php?title=1486_-_Gropi&amp;diff=8626&amp;oldid=prev</id>
		<title>Vasiliu Costel Andrei: Pagină nouă: == Enunț == Gigel a primit de la prietenul său Programatorul o hartă a grădinii acestuia. Grădina are forma dreptunghiulară şi harta pe care a primit-o Gigel conţine informaţii despre starea culturii de pomi fructiferi. Mai precis ea conţine înălţimile fiecărui copac şi zonele în care s-au săpat gropi dar încă nu au fost plantaţi copaci. Harta grădinii poate fi reprezentată sub forma unei table dreptunghiulare cu N linii, numerotate de la 1 la N de sus...</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=1486_-_Gropi&amp;diff=8626&amp;oldid=prev"/>
		<updated>2023-12-28T21:32:23Z</updated>

		<summary type="html">&lt;p&gt;Pagină nouă: == Enunț == Gigel a primit de la prietenul său Programatorul o hartă a grădinii acestuia. Grădina are forma dreptunghiulară şi harta pe care a primit-o Gigel conţine informaţii despre starea culturii de pomi fructiferi. Mai precis ea conţine înălţimile fiecărui copac şi zonele în care s-au săpat gropi dar încă nu au fost plantaţi copaci. Harta grădinii poate fi reprezentată sub forma unei table dreptunghiulare cu N linii, numerotate de la 1 la N de sus...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Enunț ==&lt;br /&gt;
Gigel a primit de la prietenul său Programatorul o hartă a grădinii acestuia. Grădina are forma dreptunghiulară şi harta pe care a primit-o Gigel conţine informaţii despre starea culturii de pomi fructiferi. Mai precis ea conţine înălţimile fiecărui copac şi zonele în care s-au săpat gropi dar încă nu au fost plantaţi copaci. Harta grădinii poate fi reprezentată sub forma unei table dreptunghiulare cu N linii, numerotate de la 1 la N de sus în jos, şi M coloane, numerotate de la 1 la M de la stânga la dreapta. În fiecare celulă se află un număr real corespunzător înălţimii copacului sau valoarea 0 corespunzătoare unei gropi.&lt;br /&gt;
&lt;br /&gt;
== Cerința ==&lt;br /&gt;
Cunoscând coordonatele unui punct de pe hartă ajutaţi-l pe Gigel să determine pe care dintre cele 8 direcţii N, NE, E, SE, S, SV, V, NV corespunzătoare acestui punct se află cele mai multe gropi.&lt;br /&gt;
&lt;br /&gt;
== Date de intrare ==&lt;br /&gt;
Fișierul de intrare gropiin.txt conține pe prima linie patru numere: N, M reprezentând dimensiunile grădinii şi X, Y reprezentând coordonatele unui punct de pe hartă – linie şi coloană. Pe următoarele N linii sunt şiruri de câte M numere corespunzătoare copacilor respectiv gropilor.&lt;br /&gt;
&lt;br /&gt;
== Date de ieșire ==&lt;br /&gt;
Fișierul de ieșire gropiout.txt va conține pe prima linie direcţia pe care se află cele mai multe gropi şi numărul acestora separate printr-un spațiu. Direcţia este indicată prin una din următoarele valori: N, NE, E, SE, S, SV, V, NV. Dacă sunt două direcţii cu acelaşi număr de gropi se va afişa ultima direcţie considerând sensul orar.&lt;br /&gt;
&lt;br /&gt;
== Restricții și precizări ==&lt;br /&gt;
* 1 &amp;amp;les; &amp;#039;&amp;#039;&amp;#039;N, M&amp;#039;&amp;#039;&amp;#039; &amp;amp;les; 1.000&lt;br /&gt;
* 1 &amp;amp;les; &amp;#039;&amp;#039;&amp;#039;X&amp;#039;&amp;#039;&amp;#039; &amp;amp;les; &amp;#039;&amp;#039;&amp;#039;N&amp;#039;&amp;#039;&amp;#039;, 1 &amp;amp;les; &amp;#039;&amp;#039;&amp;#039;Y&amp;#039;&amp;#039;&amp;#039; &amp;amp;les; &amp;#039;&amp;#039;&amp;#039;M&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
== Exemplul 1 ==&lt;br /&gt;
; Intrare&lt;br /&gt;
; gropiin.txt&lt;br /&gt;
: 4 6 3 3&lt;br /&gt;
: 2.2 4.5 0 4.3 0 8.5&lt;br /&gt;
: 6.8 0 9.4 0 7.5 9.3&lt;br /&gt;
: 1.7 0 2.6 4.7 0 0&lt;br /&gt;
: 0 3.2 6.3 8.1 5.2 2.2&lt;br /&gt;
; Ieșire&lt;br /&gt;
: Datele de intrare corespund restricțiilor impuse&lt;br /&gt;
; gropiout.txt&lt;br /&gt;
: E 2&lt;br /&gt;
&lt;br /&gt;
=== Explicație ===&lt;br /&gt;
Din punctul de coordonate 3 3 pe direcţiile: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* SE, S, SV nu se află nicio groapă&amp;lt;br&amp;gt;&lt;br /&gt;
* N, V, NV se afla câte o groapă&amp;lt;br&amp;gt;&lt;br /&gt;
* NE, E se află câte 2 gropi.&amp;lt;br&amp;gt;&lt;br /&gt;
Se va afişa ultima direcţie considerând sensul orar.&lt;br /&gt;
&lt;br /&gt;
== Exemplul 2 ==&lt;br /&gt;
; Intrare&lt;br /&gt;
; gropiin.txt&lt;br /&gt;
: 1001 6 3 3&lt;br /&gt;
: 2.2 4.5 0 4.3 0 8.5&lt;br /&gt;
: 6.8 0 9.4 0 7.5 9.3&lt;br /&gt;
: 1.7 0 2.6 4.7 0 0&lt;br /&gt;
: 0 3.2 6.3 8.1 5.2 2.2&lt;br /&gt;
; Ieșire&lt;br /&gt;
: Datele de intrare NU corespund restricțiilor impuse&lt;br /&gt;
&lt;br /&gt;
== Rezolvare ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; line&amp;gt;&lt;br /&gt;
#1486 - Gropi&lt;br /&gt;
&lt;br /&gt;
def validare_date(n, m, x, y):&lt;br /&gt;
    if not (1 &amp;lt;= n &amp;lt;= 1000) or not (1 &amp;lt;= m &amp;lt;= 1000):&lt;br /&gt;
        return False&lt;br /&gt;
    if not (1 &amp;lt;= x &amp;lt;= n) or not (1 &amp;lt;= y &amp;lt;= m):&lt;br /&gt;
        return False&lt;br /&gt;
    return True&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def numar_gropi_directie(harta, directie, x, y):&lt;br /&gt;
    directii = {&lt;br /&gt;
        &amp;#039;n&amp;#039;: (-1, 0),&lt;br /&gt;
        &amp;#039;nE&amp;#039;: (-1, 1),&lt;br /&gt;
        &amp;#039;E&amp;#039;: (0, 1),&lt;br /&gt;
        &amp;#039;SE&amp;#039;: (1, 1),&lt;br /&gt;
        &amp;#039;S&amp;#039;: (1, 0),&lt;br /&gt;
        &amp;#039;SV&amp;#039;: (1, -1),&lt;br /&gt;
        &amp;#039;V&amp;#039;: (0, -1),&lt;br /&gt;
        &amp;#039;nV&amp;#039;: (-1, -1)&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    dx, dy = directii[directie]&lt;br /&gt;
    numar_gropi = 0&lt;br /&gt;
&lt;br /&gt;
    while 1 &amp;lt;= x &amp;lt;= len(harta) and 1 &amp;lt;= y &amp;lt;= len(harta[0]):&lt;br /&gt;
        if harta[x - 1][y - 1] == 0:&lt;br /&gt;
            numar_gropi += 1&lt;br /&gt;
        x, y = x + dx, y + dy&lt;br /&gt;
&lt;br /&gt;
    return numar_gropi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def determina_directie_maxima(x, y, harta):&lt;br /&gt;
    directii = [&amp;#039;n&amp;#039;, &amp;#039;nE&amp;#039;, &amp;#039;E&amp;#039;, &amp;#039;SE&amp;#039;, &amp;#039;S&amp;#039;, &amp;#039;SV&amp;#039;, &amp;#039;V&amp;#039;, &amp;#039;nV&amp;#039;]&lt;br /&gt;
    max_gropi = -1&lt;br /&gt;
    directie_maxima = None&lt;br /&gt;
&lt;br /&gt;
    for directie in directii:&lt;br /&gt;
        x_temp, y_temp = x, y&lt;br /&gt;
        numar_gropi = numar_gropi_directie(harta, directie, x_temp, y_temp)&lt;br /&gt;
&lt;br /&gt;
        if numar_gropi &amp;gt; max_gropi or (numar_gropi == max_gropi and directie_maxima is not None and directii.index(directie) &amp;gt; directii.index(directie_maxima)):&lt;br /&gt;
            max_gropi = numar_gropi&lt;br /&gt;
            directie_maxima = directie&lt;br /&gt;
&lt;br /&gt;
    return directie_maxima, max_gropi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def main():&lt;br /&gt;
    with open(&amp;quot;gropiin.txt&amp;quot;, &amp;quot;r&amp;quot;) as f:&lt;br /&gt;
        n, m, x, y = map(int, f.readline().split())&lt;br /&gt;
        harta = [list(map(float, f.readline().split())) for _ in range(n)]&lt;br /&gt;
&lt;br /&gt;
    if validare_date(n, m, x, y):&lt;br /&gt;
        print(&amp;quot;Datele de intrare corespund restricțiilor impuse&amp;quot;)       &lt;br /&gt;
        &lt;br /&gt;
        directie, numar_gropi = determina_directie_maxima(x, y, harta)&lt;br /&gt;
&lt;br /&gt;
        with open(&amp;quot;gropiout.txt&amp;quot;, &amp;quot;w&amp;quot;) as f:&lt;br /&gt;
            f.write(f&amp;quot;{directie} {numar_gropi}\n&amp;quot;)&lt;br /&gt;
    else:&lt;br /&gt;
        print(&amp;quot;Datele de intrare NU corespund restricțiilor impuse&amp;quot;)&lt;br /&gt;
        exit(0)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
    main()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vasiliu Costel Andrei</name></author>
	</entry>
</feed>