<?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=3003_-_Intersectie</id>
	<title>3003 - Intersectie - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.universitas.ro/index.php?action=history&amp;feed=atom&amp;title=3003_-_Intersectie"/>
	<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=3003_-_Intersectie&amp;action=history"/>
	<updated>2026-06-17T09:44:14Z</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=3003_-_Intersectie&amp;diff=9876&amp;oldid=prev</id>
		<title>Benzar Ioan at 20:31, 2 June 2024</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=3003_-_Intersectie&amp;diff=9876&amp;oldid=prev"/>
		<updated>2024-06-02T20:31:50Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;//wiki.universitas.ro/index.php?title=3003_-_Intersectie&amp;amp;diff=9876&amp;amp;oldid=9834&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Benzar Ioan</name></author>
	</entry>
	<entry>
		<id>https://wiki.universitas.ro/index.php?title=3003_-_Intersectie&amp;diff=9834&amp;oldid=prev</id>
		<title>Benzar Ioan: /* Rezolvare */</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=3003_-_Intersectie&amp;diff=9834&amp;oldid=prev"/>
		<updated>2024-05-28T12:44:57Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Rezolvare&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 12:44, 28 May 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-l30&quot;&gt;Line 30:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 30:&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;== Rezolvare ==&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;== Rezolvare ==&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;&amp;lt;syntaxhighlight lang=&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;python” &lt;/del&gt;line&amp;gt;&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;&amp;lt;syntaxhighlight lang=&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot;python&quot; &lt;/ins&gt;line&amp;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;div&gt;def citeste_vectori():&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 citeste_vectori():&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;     try:&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;     try:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Benzar Ioan</name></author>
	</entry>
	<entry>
		<id>https://wiki.universitas.ro/index.php?title=3003_-_Intersectie&amp;diff=9833&amp;oldid=prev</id>
		<title>Benzar Ioan: Pagină nouă: == Cerința == Se dau doi vectori de numere întregi. Să se determine vectorul care conține elementele comune celor doi vectori, sortat în ordine crescătoare. == Date de intrare == Programul citește de la tastatură doi vectori de numere întregi. == Date de ieșire == Pe ecran se va afișa mesajul: &quot;Datele de intrare corespund restricțiilor impuse.&quot; În următorul rând se va afișa pe ecran vectorul cu elementele comune celor doi vectori, sortat în ordine crescătoar...</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=3003_-_Intersectie&amp;diff=9833&amp;oldid=prev"/>
		<updated>2024-05-28T12:44:08Z</updated>

		<summary type="html">&lt;p&gt;Pagină nouă: == Cerința == Se dau doi vectori de numere întregi. Să se determine vectorul care conține elementele comune celor doi vectori, sortat în ordine crescătoare. == Date de intrare == Programul citește de la tastatură doi vectori de numere întregi. == Date de ieșire == Pe ecran se va afișa mesajul: &amp;quot;Datele de intrare corespund restricțiilor impuse.&amp;quot; În următorul rând se va afișa pe ecran vectorul cu elementele comune celor doi vectori, sortat în ordine crescătoar...&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 doi vectori de numere întregi. Să se determine vectorul care conține elementele comune celor doi vectori, sortat în ordine crescătoare.&lt;br /&gt;
== Date de intrare ==&lt;br /&gt;
Programul citește de la tastatură doi vectori de numere întregi.&lt;br /&gt;
== Date de ieșire ==&lt;br /&gt;
Pe ecran se va afișa mesajul: &amp;quot;Datele de intrare corespund restricțiilor impuse.&amp;quot;&lt;br /&gt;
În următorul rând se va afișa pe ecran vectorul cu elementele comune celor doi vectori, sortat în ordine crescătoare. Dacă nu există elemente comune, se va afișa un vector gol.&lt;br /&gt;
&lt;br /&gt;
În cazul în care datele introduse de la tastatură nu îndeplinesc cerințele enunțate, pe ecran se va afișa mesajul &amp;quot;Datele de intrare nu corespund restricțiilor impuse.&amp;quot;&lt;br /&gt;
== Restricții și precizări ==&lt;br /&gt;
* Vectorii pot conține până la 100.000 de elemente fiecare.&lt;br /&gt;
* 1 &amp;amp;les; &amp;#039;&amp;#039;&amp;#039;numar_elemente_vector1&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;numar_elemente_vector2&amp;#039;&amp;#039;&amp;#039; &amp;amp;les; 100000&lt;br /&gt;
== Exemplu 1 ==&lt;br /&gt;
;Intrare&lt;br /&gt;
1 2 3 4 5 &amp;lt;br&amp;gt;&lt;br /&gt;
3 4 5 6 7&lt;br /&gt;
&lt;br /&gt;
;Iesire&lt;br /&gt;
Datele de intrare corespund restricțiilor impuse.&lt;br /&gt;
[3, 4, 5]&lt;br /&gt;
&lt;br /&gt;
== Exemplu 2 ==&lt;br /&gt;
;Intrare&lt;br /&gt;
1 1 2 2 &amp;lt;br&amp;gt;&lt;br /&gt;
3 3 4 4&lt;br /&gt;
&lt;br /&gt;
;Iesire&lt;br /&gt;
Datele de intrare corespund restricțiilor impuse.&lt;br /&gt;
[]&lt;br /&gt;
&lt;br /&gt;
== Rezolvare ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=python” line&amp;gt;&lt;br /&gt;
def citeste_vectori():&lt;br /&gt;
    try:&lt;br /&gt;
        vector_1 = list(map(int, input(&amp;quot;Introduceți elementele primului vector: &amp;quot;).split()))&lt;br /&gt;
        vector_2 = list(map(int, input(&amp;quot;Introduceți elementele celui de-al doilea vector: &amp;quot;).split()))&lt;br /&gt;
        return vector_1, vector_2&lt;br /&gt;
    except ValueError:&lt;br /&gt;
        return None, None&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def valideaza_date(vector_1, vector_2):&lt;br /&gt;
    if len(vector_1) &amp;lt;= 100000 and len(vector_2) &amp;lt;= 100000:&lt;br /&gt;
        if all(-10 ** 9 &amp;lt;= elem &amp;lt;= 10 ** 9 for elem in vector_1) and all(&lt;br /&gt;
                -10 ** 9 &amp;lt;= elem &amp;lt;= 10 ** 9 for elem in vector_2):&lt;br /&gt;
            return True&lt;br /&gt;
    return False&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def intersectie_sortata(vector_1, vector_2):&lt;br /&gt;
    set_1 = set(vector_1)&lt;br /&gt;
    set_2 = set(vector_2)&lt;br /&gt;
    intersectie = sorted(set_1 &amp;amp; set_2)&lt;br /&gt;
    return intersectie&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def main():&lt;br /&gt;
    vector_1, vector_2 = citeste_vectori()&lt;br /&gt;
&lt;br /&gt;
    if vector_1 is None or vector_2 is None:&lt;br /&gt;
        print(&amp;quot;Datele de intrare nu corespund restricțiilor impuse.&amp;quot;)&lt;br /&gt;
        return&lt;br /&gt;
&lt;br /&gt;
    if valideaza_date(vector_1, vector_2):&lt;br /&gt;
        print(&amp;quot;Datele de intrare corespund restricțiilor impuse.&amp;quot;)&lt;br /&gt;
        rezultat = intersectie_sortata(vector_1, vector_2)&lt;br /&gt;
        print(rezultat)&lt;br /&gt;
    else:&lt;br /&gt;
        print(&amp;quot;Datele de intrare nu corespund restricțiilor impuse.&amp;quot;)&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>Benzar Ioan</name></author>
	</entry>
</feed>