Detalii evaluare #64091909

Rezumat problemă

#1327

Se citeşte un număr natural nenul n, apoi n numere naturale distincte. Să se afişeze, în ordine lexicografică, șirurile din cele n valori cu proprietatea că oricare două valori învecinate sunt prime între ele.

Detalii

Problema SirPIE Operații I/O sirpie.in/sirpie.out
Limita timp 0.5 secunde Limita memorie Total: 64 MB / Stivă 8 MB
Id soluție #64091909 Utilizator Grumazescu Amalia (xaamaliax)
Fișier sirpie.cpp Dimensiune 1.21 KB
Data încărcării 16 Aprilie 2026, 14:40 Scor/rezultat Eroare de compilare

Evaluare

Mesaj compilare

sirpie.cpp:1:10: error: #include expects "FILENAME" or <FILENAME>
    1 | #include &lt;iostream&gt;
      |          ^
sirpie.cpp:2:10: error: #include expects "FILENAME" or <FILENAME>
    2 | #include &lt;fstream&gt;
      |          ^
sirpie.cpp:3:10: error: #include expects "FILENAME" or <FILENAME>
    3 | #include &lt;vector&gt;
      |          ^
sirpie.cpp:26:39: error: stray ‘#’ in program
   26 | fout &lt;&lt; element[v[i]] &lt;&lt; &#39; &#39;;
      |                                       ^
sirpie.cpp:26:45: error: stray ‘#’ in program
   26 | fout &lt;&lt; element[v[i]] &lt;&lt; &#39; &#39;;
      |                                             ^
sirpie.cpp:27:16: error: stray ‘#’ in program
   27 | fout &lt;&lt; &#39;\n&#39;;
      |                ^
sirpie.cpp:27:20: error: stray ‘\’ in program
   27 | fout &lt;&lt; &#39;\n&#39;;
      |                    ^
sirpie.cpp:27:23: error: stray ‘#’ in program
   27 | fout &lt;&lt; &#39;\n&#39;;
      |                       ^
sirpie.cpp:63:10: error: #include expects "FILENAME" or <FILENAME>
   63 | #include &lt;algorithm&gt;
      |          ^
sirpie.cpp:6:1: error: ‘ifstream’ does not name a type
    6 | ifstream fin(&quot;sirpie.in&quot;);
      | ^~~~~~~~
sirpie.cpp:6:20: error: ‘sirpie’ does not name a type
    6 | ifstream fin(&quot;sirpie.in&quot;);
      |                    ^~~~~~
sirpie.cpp:6:35: error: expected unqualified-id before ‘)’ token
    6 | ifstream fin(&quot;sirpie.in&quot;);
      |                                   ^
sirpie.cpp:7:1: error: ‘ofstream’ does not name a type
    7 | ofstream fout(&quot;sirpie.out&quot;);
      | ^~~~~~~~
sirpie.cpp:7:21: error: ‘sirpie’ does not name a type
    7 | ofstream fout(&quot;sirpie.out&quot;);
      |                     ^~~~~~
sirpie.cpp:7:37: error: expected unqualified-id before ‘)’ token
    7 | ofstream fout(&quot;sirpie.out&quot;);
      |                                     ^
sirpie.cpp:9:1: error: ‘descrescatoare’ does not name a type
    9 | descrescatoare
      | ^~~~~~~~~~~~~~
sirpie.cpp:10:15: error: ‘gt’ declared as reference but not initialized
   10 | vector&lt;int&gt; v;
      |               ^~
sirpie.cpp:10:19: error: ‘v’ does not name a type
   10 | vector&lt;int&gt; v;
      |                   ^
sirpie.cpp:11:1: error: ‘vector’ does not name a type
   11 | vector&lt;int&gt; element;
      | ^~~~~~
sirpie.cpp:11:15: error: redefinition of ‘int& gt’
   11 | vector&lt;int&gt; element;
      |               ^~
sirpie.cpp:10:15: note: ‘int& gt’ previously declared here
   10 | vector&lt;int&gt; v;
      |               ^~
sirpie.cpp:11:19: error: ‘element’ does not name a type
   11 | vector&lt;int&gt; element;
      |                   ^~~~~~~
sirpie.cpp: In function ‘int cmmdc(int, int)’:
sirpie.cpp:15:13: error: expected ‘)’ before ‘;’ token
   15 | while (b &gt; 0)
      |       ~     ^
      |             )
sirpie.cpp:15:1: warning: this ‘while’ clause does not guard... [-Wmisleading-indentation]
   15 | while (b &gt; 0)
      | ^~~~~
sirpie.cpp:15:15: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘while’
   15 | while (b &gt; 0)
      |               ^
sirpie.cpp:15:16: error: expected ‘;’ before ‘)’ token
   15 | while (b &gt; 0)
      |                ^
      |                ;
sirpie.cpp:15:15: warning: statement has no effect [-Wunused-value]
   15 | while (b &gt; 0)
      |               ^
sirpie.cpp: In function ‘void afisare()’:
sirpie.cpp:25:20: error: ‘lt’ was not declared in this scope; did you mean ‘gt’?
   25 | for (int i = 0; i &lt; v.size(); i++)
      |                    ^~
      |                    gt
sirpie.cpp:25:24: error: ‘v’ was not declared in this scope
   25 | for (int i = 0; i &lt; v.size(); i++)
      |                        ^
sirpie.cpp:25:32: error: expected ‘)’ before ‘;’ token
   25 | for (int i = 0; i &lt; v.size(); i++)
      |     ~                          ^
      |                                )
sirpie.cpp:25:1: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
   25 | for (int i = 0; i &lt; v.size(); i++)
      | ^~~
sirpie.cpp:25:34: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
   25 | for (int i = 0; i &lt; v.size(); i++)
      |                                  ^
sirpie.cpp:25:34: error: ‘i’ was not declared in this scope
sirpie.cpp:26:11: error: ‘lt’ was not declared in this scope; did you mean ‘gt’?
   26 | fout &lt;&lt; element[v[i]] &lt;&lt; &#39; &#39;;
      |           ^~
      |           gt
sirpie.cpp:26:15: error: ‘element’ was not declared in this scope
   26 | fout &lt;&lt; element[v[i]] &lt;&lt; &#39; &#39;;
      |               ^~~~~~~
sirpie.cpp:26:23: error: ‘v’ was not declared in this scope
   26 | fout &lt;&lt; element[v[i]] &lt;&lt; &#39; &#39;;
      |                       ^
sirpie.cpp:26:40: error: lvalue required as unary ‘&’ operand
   26 | fout &lt;&lt; element[v[i]] &lt;&lt; &#39; &#39;;
      |                                        ^~
sirpie.cpp:26:46: error: lvalue required as unary ‘&’ operand
   26 | fout &lt;&lt; element[v[i]] &lt;&lt; &#39; &#39;;
      |                                              ^~
sirpie.cpp:27:1: error: ‘fout’ was not declared in this scope
   27 | fout &lt;&lt; &#39;\n&#39;;
      | ^~~~
sirpie.cpp:27:17: error: lvalue required as unary ‘&’ operand
   27 | fout &lt;&lt; &#39;\n&#39;;
      |                 ^~
sirpie.cpp:27:22: warning: statement has no effect [-Wunused-value]
   27 | fout &lt;&lt; &#39;\n&#39;;
      |                     ~^~~~
sirpie.cpp: In function ‘bool solutie(int)’:
sirpie.cpp:31:13: error: ‘v’ was not declared in this scope
   31 | return k == v.size() - 1;
      |             ^
sirpie.cpp: In function ‘bool ok(int)’:
sirpie.cpp:37:5: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   37 | if (k &gt; 0 &amp;&amp; cmmdc(element[v[k]], element[v[k - 1]]) != 1)
      |     ^
sirpie.cpp:37:7: warning: statement has no effect [-Wunused-value]
   37 | if (k &gt; 0 &amp;&amp; cmmdc(element[v[k]], element[v[k - 1]]) != 1)
      |     ~~^~~
sirpie.cpp:37:15: error: ‘amp’ was not declared in this scope
   37 | if (k &gt; 0 &amp;&amp; cmmdc(element[v[k]], element[v[k - 1]]) != 1)
      |               ^~~
sirpie.cpp:37:18: error: expected ‘)’ before ‘;’ token
   37 | if (k &gt; 0 &amp;&amp; cmmdc(element[v[k]], element[v[k - 1]]) != 1)
      |    ~             ^
      |                  )
sirpie.cpp:37:1: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
   37 | if (k &gt; 0 &amp;&amp; cmmdc(element[v[k]], element[v[k - 1]]) != 1)
      | ^~
sirpie.cpp:37:19: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
   37 | if (k &gt; 0 &amp;&amp; cmmdc(element[v[k]], element[v[k - 1]]) != 1)
      |                   ^
sirpie.cpp:37:20: error: ‘amp’ was not declared in this scope
   37 | if (k &gt; 0 &amp;&amp; cmmdc(element[v[k]], element[v[k - 1]]) != 1)
      |                    ^~~
sirpie.cpp:37:31: error: ‘element’ was not declared in this scope
   37 | if (k &gt; 0 &amp;&amp; cmmdc(element[v[k]], element[v[k - 1]]) != 1)
      |                               ^~~~~~~
sirpie.cpp:37:39: error: ‘v’ was not declared in this scope
   37 | if (k &gt; 0 &amp;&amp; cmmdc(element[v[k]], element[v[k - 1]]) != 1)
      |                                       ^
sirpie.cpp:39:20: error: ‘lt’ was not declared in this scope; did you mean ‘gt’?
   39 | for (int i = 0; i &lt; k; i++)
      |                    ^~
      |                    gt
sirpie.cpp:39:24: warning: for increment expression has no effect [-Wunused-value]
   39 | for (int i = 0; i &lt; k; i++)
      |                        ^
sirpie.cpp:39:25: error: expected ‘)’ before ‘;’ token
   39 | for (int i = 0; i &lt; k; i++)
      |     ~                   ^
      |                         )
sirpie.cpp:39:1: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
   39 | for (int i = 0; i &lt; k; i++)
      | ^~~
sirpie.cpp:39:27: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
   39 | for (int i = 0; i &lt; k; i++)
      |                           ^
sirpie.cpp:39:27: error: ‘i’ was not declared in this scope
sirpie.cpp: In function ‘void back(int)’:
sirpie.cpp:48:20: error: ‘lt’ was not declared in this scope; did you mean ‘gt’?
   48 | for (int i = 0; i &lt; n; i++)
      |                    ^~
      |                    gt
sirpie.cpp:48:24: warning: for increment expression has no effect [-Wunused-value]
   48 | for (int i = 0; i &lt; n; i++)
      |                        ^
sirpie.cpp:48:25: error: expected ‘)’ before ‘;’ token
   48 | for (int i = 0; i &lt; n; i++)
      |     ~                   ^
      |                         )
sirpie.cpp:48:1: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
   48 | for (int i = 0; i &lt; n; i++)
      | ^~~
sirpie.cpp:48:27: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
   48 | for (int i = 0; i &lt; n; i++)
      |                           ^
sirpie.cpp:48:27: error: ‘i’ was not declared in this scope
sirpie.cpp: In function ‘int main()’:
sirpie.cpp:66:1: error: ‘fin’ was not declared in this scope
   66 | fin &gt;&gt; n;
      | ^~~
sirpie.cpp:66:9: warning: statement has no effect [-Wunused-value]
   66 | fin &gt;&gt; n;
      |         ^~~
sirpie.cpp:66:14: warning: statement has no effect [-Wunused-value]
   66 | fin &gt;&gt; n;
      |              ^
sirpie.cpp:67:1: error: ‘element’ was not declared in this scope
   67 | element.resize(n);
      | ^~~~~~~
sirpie.cpp:68:20: error: ‘lt’ was not declared in this scope; did you mean ‘gt’?
   68 | for (int i = 0; i &lt; n; i++)
      |                    ^~
      |                    gt
sirpie.cpp:68:24: warning: for increment expression has no effect [-Wunused-value]
   68 | for (int i = 0; i &lt; n; i++)
      |                        ^
sirpie.cpp:68:25: error: expected ‘)’ before ‘;’ token
   68 | for (int i = 0; i &lt; n; i++)
      |     ~                   ^
      |                         )
sirpie.cpp:68:1: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
   68 | for (int i = 0; i &lt; n; i++)
      | ^~~
sirpie.cpp:68:27: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
   68 | for (int i = 0; i &lt; n; i++)
      |                           ^
sirpie.cpp:68:27: error: ‘i’ was not declared in this scope
sirpie.cpp:69:9: warning: statement has no effect [-Wunused-value]
   69 | fin &gt;&gt; element[i];
      |         ^~~
sirpie.cpp:70:1: error: ‘sort’ was not declared in this scope; did you mean ‘short’?
   70 | sort(element.begin(), element.end());
      | ^~~~
      | short
sirpie.cpp:71:1: error: ‘v’ was not declared in this scope
   71 | v.resize(n);
      | ^

Cum funcționează evaluarea?

www.pbinfo.ro permite evaluarea a două tipuri de probleme:

  • probleme la care rezolvarea presupune scrierea unui program complet
  • probleme la care rezolvarea presupune scrierea unei secvențe de program - câteva instrucțiuni, o listă de declarații, una sau mai multe funcții, etc.

Problema SirPIE face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:

  • Programul sursă este compilat folosind compilatorul corespunzător. Dacă în urma compilării se obțin erori sau avertismente, acestea sunt afișate în această pagină.
  • Dacă programul a fost compilat, executabilul obținut va fi rulat, furnizându-i-se unul sau mai multe seturi de date de intrare, în concordanță cu restricțiile specifice problemei. Pentru fiecare set de date se obține un anumit punctaj, în raport cu corectitudinea soluției tale.

Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.

Du-te sus!