<?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=2636_-_Noduri_Izolate</id>
	<title>2636 - Noduri Izolate - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.universitas.ro/index.php?action=history&amp;feed=atom&amp;title=2636_-_Noduri_Izolate"/>
	<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=2636_-_Noduri_Izolate&amp;action=history"/>
	<updated>2026-05-01T03:41:05Z</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=2636_-_Noduri_Izolate&amp;diff=8784&amp;oldid=prev</id>
		<title>Corjuc Eunice: /* Exemplul 2 */</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=2636_-_Noduri_Izolate&amp;diff=8784&amp;oldid=prev"/>
		<updated>2024-01-02T19:32:34Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Exemplul 2&lt;/span&gt;&lt;/span&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 19:32, 2 January 2024&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-l21&quot;&gt;Line 21:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 21:&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;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;0 1&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&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;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&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;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Explicație:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&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;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&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;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Se poate construi un graf fără noduri izolate, cu muchiile &amp;lt;code&amp;gt;(1,2)&amp;lt;/code&amp;gt; și &amp;lt;code&amp;gt;(3,4)&amp;lt;/code&amp;gt;. Pentru a obține un nod izolat, putem construi un graf cu muchiile &amp;lt;code&amp;gt;(1,2)&amp;lt;/code&amp;gt; și &amp;lt;code&amp;gt;(1,3)&amp;lt;/code&amp;gt;.&lt;/ins&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 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;== Exemplul 2 ==&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;== Exemplul 2 ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Corjuc Eunice</name></author>
	</entry>
	<entry>
		<id>https://wiki.universitas.ro/index.php?title=2636_-_Noduri_Izolate&amp;diff=8183&amp;oldid=prev</id>
		<title>Corjuc Eunice: Pagină nouă: = Cerința = Se dau două numere &lt;code&gt;n&lt;/code&gt; și &lt;code&gt;m&lt;/code&gt;. Aflați care este numărul minim și numărul maxim de noduri izolate într-un graf neorientat cu &lt;code&gt;n&lt;/code&gt; noduri și &lt;code&gt;m&lt;/code&gt; muchii în care nu există o muchie de la un nod la el însuși și între oricare două noduri diferite există cel mult o muchie.  = Date de intrare = Programul citește de la tastatură numerele &lt;code&gt;n m&lt;/code&gt;.  = Date de ieșire = Programul va afișa pe ecran numerel...</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=2636_-_Noduri_Izolate&amp;diff=8183&amp;oldid=prev"/>
		<updated>2023-12-16T14:29:07Z</updated>

		<summary type="html">&lt;p&gt;Pagină nouă: = Cerința = Se dau două numere &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; și &amp;lt;code&amp;gt;m&amp;lt;/code&amp;gt;. Aflați care este numărul minim și numărul maxim de noduri izolate într-un graf neorientat cu &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; noduri și &amp;lt;code&amp;gt;m&amp;lt;/code&amp;gt; muchii în care nu există o muchie de la un nod la el însuși și între oricare două noduri diferite există cel mult o muchie.  = Date de intrare = Programul citește de la tastatură numerele &amp;lt;code&amp;gt;n m&amp;lt;/code&amp;gt;.  = Date de ieșire = Programul va afișa pe ecran numerel...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Cerința =&lt;br /&gt;
Se dau două numere &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; și &amp;lt;code&amp;gt;m&amp;lt;/code&amp;gt;. Aflați care este numărul minim și numărul maxim de noduri izolate într-un graf neorientat cu &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; noduri și &amp;lt;code&amp;gt;m&amp;lt;/code&amp;gt; muchii în care nu există o muchie de la un nod la el însuși și între oricare două noduri diferite există cel mult o muchie.&lt;br /&gt;
&lt;br /&gt;
= Date de intrare =&lt;br /&gt;
Programul citește de la tastatură numerele &amp;lt;code&amp;gt;n m&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
= Date de ieșire =&lt;br /&gt;
Programul va afișa pe ecran numerele &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; și &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt;, reprezentând numărul minim, respectiv numărul maxim de noduri izolate într-un graf neorientat cu &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; noduri și &amp;lt;code&amp;gt;m&amp;lt;/code&amp;gt; muchii în care nu există o muchie de la un nod la el însuși și între oricare două noduri diferite există cel mult o muchie.&lt;br /&gt;
&lt;br /&gt;
= Restricții și precizări =&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;1 ≤ n ≤ 100.000&amp;lt;/code&amp;gt;&lt;br /&gt;
* 0&amp;lt;=m&amp;lt;=n*(n-1)/2&lt;br /&gt;
&lt;br /&gt;
= Exemplul 1 =&lt;br /&gt;
Input:&lt;br /&gt;
&lt;br /&gt;
4 2&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
0 1&lt;br /&gt;
&lt;br /&gt;
== Exemplul 2 ==&lt;br /&gt;
Input:&lt;br /&gt;
&lt;br /&gt;
99999999 2&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
Restrictiile nu sunt indeplinite.&lt;br /&gt;
&lt;br /&gt;
== Rezolvare ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot; line=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
def check_restrictions(n, m):&lt;br /&gt;
    return 1 &amp;lt;= n &amp;lt;= 100000 and 0 &amp;lt;= m &amp;lt;= n * (n - 1) // 2&lt;br /&gt;
&lt;br /&gt;
def calculate_isolated_nodes(n, m):&lt;br /&gt;
    # Verifică restricțiile&lt;br /&gt;
    if not check_restrictions(n, m):&lt;br /&gt;
        print(&amp;quot;Restrictiile nu sunt indeplinite.&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # Numărul minim de noduri izolate&lt;br /&gt;
    min_isolated_nodes = 0&lt;br /&gt;
&lt;br /&gt;
    # Numărul maxim de noduri izolate&lt;br /&gt;
    max_isolated_nodes = max(0, min(n - m, 1))&lt;br /&gt;
&lt;br /&gt;
    return min_isolated_nodes, max_isolated_nodes&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
    n = int(input(&amp;quot;Introduceti numarul de noduri (n): &amp;quot;))&lt;br /&gt;
    m = int(input(&amp;quot;Introduceti numarul de muchii (m): &amp;quot;))&lt;br /&gt;
&lt;br /&gt;
    result = calculate_isolated_nodes(n, m)&lt;br /&gt;
&lt;br /&gt;
    if result is not None:&lt;br /&gt;
        min_isolated, max_isolated = result&lt;br /&gt;
        print(f&amp;quot;Numarul minim de noduri izolate: {min_isolated}&amp;quot;)&lt;br /&gt;
        print(f&amp;quot;Numarul maxim de noduri izolate: {max_isolated}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Corjuc Eunice</name></author>
	</entry>
</feed>