<?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=3463_-_Lumini_2</id>
	<title>3463 - Lumini 2 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.universitas.ro/index.php?action=history&amp;feed=atom&amp;title=3463_-_Lumini_2"/>
	<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=3463_-_Lumini_2&amp;action=history"/>
	<updated>2026-05-01T07:33:50Z</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=3463_-_Lumini_2&amp;diff=9881&amp;oldid=prev</id>
		<title>Benzar Ioan at 21:05, 2 June 2024</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=3463_-_Lumini_2&amp;diff=9881&amp;oldid=prev"/>
		<updated>2024-06-02T21:05:51Z</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:05, 2 June 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-l99&quot;&gt;Line 99:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 99:&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;         f.write(f&amp;quot;{rezultat}\n&amp;quot;)&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;         f.write(f&amp;quot;{rezultat}\n&amp;quot;)&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; 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;def &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;rezolva&lt;/del&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;def &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;main&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;div&gt;     N, M, C, matrice = citire_date()&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;     N, M, C, matrice = citire_date()&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-l115&quot;&gt;Line 115:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 115:&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;if __name__ == &amp;quot;__main__&amp;quot;:&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;if __name__ == &amp;quot;__main__&amp;quot;:&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;     &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;rezolva&lt;/del&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;     &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;main&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;&amp;lt;/syntaxhighlight&amp;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;&amp;lt;/syntaxhighlight&amp;gt;&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=3463_-_Lumini_2&amp;diff=9880&amp;oldid=prev</id>
		<title>Benzar Ioan at 21:04, 2 June 2024</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=3463_-_Lumini_2&amp;diff=9880&amp;oldid=prev"/>
		<updated>2024-06-02T21:04:45Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;//wiki.universitas.ro/index.php?title=3463_-_Lumini_2&amp;amp;diff=9880&amp;amp;oldid=9838&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Benzar Ioan</name></author>
	</entry>
	<entry>
		<id>https://wiki.universitas.ro/index.php?title=3463_-_Lumini_2&amp;diff=9838&amp;oldid=prev</id>
		<title>Benzar Ioan: Pagină nouă: == Cerința == Scrieţi un program care să găsească elementele comune dintre doi vectori de numere întregi ordonați crescător, utilizând căutarea binară pentru a face operațiunea cât mai eficientă. Fiecare element din vectori reprezintă un punct luminos într-un experiment, iar scopul este de a determina care dintre aceste puncte luminoase apar în ambele experimente. == Date de intrare == Programul citește de la tastatură doi vectori de numere întregi ordona...</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=3463_-_Lumini_2&amp;diff=9838&amp;oldid=prev"/>
		<updated>2024-05-28T13:08:59Z</updated>

		<summary type="html">&lt;p&gt;Pagină nouă: == Cerința == Scrieţi un program care să găsească elementele comune dintre doi vectori de numere întregi ordonați crescător, utilizând căutarea binară pentru a face operațiunea cât mai eficientă. Fiecare element din vectori reprezintă un punct luminos într-un experiment, iar scopul este de a determina care dintre aceste puncte luminoase apar în ambele experimente. == Date de intrare == Programul citește de la tastatură doi vectori de numere întregi ordona...&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;
Scrieţi un program care să găsească elementele comune dintre doi vectori de numere întregi ordonați crescător, utilizând căutarea binară pentru a face operațiunea cât mai eficientă. Fiecare element din vectori reprezintă un punct luminos într-un experiment, iar scopul este de a determina care dintre aceste puncte luminoase apar în ambele experimente.&lt;br /&gt;
== Date de intrare ==&lt;br /&gt;
Programul citește de la tastatură doi vectori de numere întregi ordonați crescător.&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. 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;
* 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;
;Iesire&lt;br /&gt;
Datele de intrare corespund restricțiilor impuse.&lt;br /&gt;
[3, 4, 5]&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;
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;
def valideaza_date(vector_1, vector_2):&lt;br /&gt;
    if 1 &amp;lt;= len(vector_1) &amp;lt;= 100000 and 1 &amp;lt;= 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(-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;
def cautare_binara(vector, element):&lt;br /&gt;
    stanga, dreapta = 0, len(vector) - 1&lt;br /&gt;
    while stanga &amp;lt;= dreapta:&lt;br /&gt;
        mijloc = (stanga + dreapta) // 2&lt;br /&gt;
        if vector[mijloc] == element:&lt;br /&gt;
            return True&lt;br /&gt;
        elif vector[mijloc] &amp;lt; element:&lt;br /&gt;
            stanga = mijloc + 1&lt;br /&gt;
        else:&lt;br /&gt;
            dreapta = mijloc - 1&lt;br /&gt;
    return False&lt;br /&gt;
&lt;br /&gt;
def intersectie_binara(vector_1, vector_2):&lt;br /&gt;
    rezultat = []&lt;br /&gt;
    for element in vector_1:&lt;br /&gt;
        if cautare_binara(vector_2, element):&lt;br /&gt;
            rezultat.append(element)&lt;br /&gt;
    return rezultat&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_binara(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;
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>