#4872
Se dau două șiruri binare a și b, ambele de lungime n. Să se determine două poziții i și j, cu i ≤ j, aflate la distanță maximă (adică j - i = maxim posibil) și cu proprietatea că numărul de valori de 1 din secvența a[i], a[i+1], ..., a[j] este egal cu numărul de valori de 1 din secvența b[i], b[i+1], ..., b[j].
| Problema | SiruriBinare | Operații I/O |
siruribinare.in/siruribinare.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #60592781 | Utilizator | |
| Fișier | siruribinare.cpp | Dimensiune | 1.72 KB |
| Data încărcării | 05 Noiembrie 2025, 18:46 | Scor/rezultat | Eroare de compilare |
siruribinare.cpp:1:7: error: expected nested-name-specifier before 'System' using System; ^ siruribinare.cpp:1:7: error: 'System' has not been declared siruribinare.cpp:2:7: error: expected nested-name-specifier before 'System' using System.Collections.Generic; ^ siruribinare.cpp:2:7: error: 'System' has not been declared siruribinare.cpp:2:13: error: expected ';' before '.' token using System.Collections.Generic; ^ siruribinare.cpp:2:13: error: expected unqualified-id before '.' token siruribinare.cpp:3:7: error: expected nested-name-specifier before 'System' using System.Linq; ^ siruribinare.cpp:3:7: error: 'System' has not been declared siruribinare.cpp:3:13: error: expected ';' before '.' token using System.Linq; ^ siruribinare.cpp:3:13: error: expected unqualified-id before '.' token siruribinare.cpp:4:7: error: expected nested-name-specifier before 'System' using System.Text; ^ siruribinare.cpp:4:7: error: 'System' has not been declared siruribinare.cpp:4:13: error: expected ';' before '.' token using System.Text; ^ siruribinare.cpp:4:13: error: expected unqualified-id before '.' token siruribinare.cpp:5:7: error: expected nested-name-specifier before 'System' using System.IO; ^ siruribinare.cpp:5:7: error: 'System' has not been declared siruribinare.cpp:5:13: error: expected ';' before '.' token using System.IO; ^ siruribinare.cpp:5:13: error: expected unqualified-id before '.' token siruribinare.cpp:10:26: error: 'string' has not been declared static void Main(string[] args) ^ siruribinare.cpp:10:35: error: expected ',' or '...' before 'args' static void Main(string[] args) ^ siruribinare.cpp:60:5: error: expected ';' after class definition } ^ siruribinare.cpp: In static member function 'static void ConsoleApplication32::Program::Main(int*)': siruribinare.cpp:12:13: error: 'StreamReader' was not declared in this scope StreamReader fin = File.OpenText("siruribinare.in"); ^ siruribinare.cpp:12:26: error: expected ';' before 'fin' StreamReader fin = File.OpenText("siruribinare.in"); ^ siruribinare.cpp:13:13: error: 'StreamWriter' was not declared in this scope StreamWriter fout = File.CreateText("siruribinare.out"); ^ siruribinare.cpp:13:26: error: expected ';' before 'fout' StreamWriter fout = File.CreateText("siruribinare.out"); ^ siruribinare.cpp:14:21: error: expected primary-expression before 'int' int n = int.Parse(fin.ReadLine()); ^ siruribinare.cpp:15:16: error: expected unqualified-id before '[' token int[,] d = new int[2, 100000]; ^ siruribinare.cpp:19:17: error: 'string' was not declared in this scope string s = fin.ReadLine(); ^ siruribinare.cpp:19:24: error: expected ';' before 's' string s = fin.ReadLine(); ^ siruribinare.cpp:20:24: error: expected primary-expression before ']' token string[] nr = s.Split(); ^ siruribinare.cpp:20:26: error: expected ';' before 'nr' string[] nr = s.Split(); ^ siruribinare.cpp:23:21: error: 'd' was not declared in this scope d[i,j] = int.Parse(nr[j-1]); ^ siruribinare.cpp:23:25: warning: left operand of comma operator has no effect [-Wunused-value] d[i,j] = int.Parse(nr[j-1]); ^ siruribinare.cpp:23:30: error: expected primary-expression before 'int' d[i,j] = int.Parse(nr[j-1]); ^ siruribinare.cpp:23:30: error: expected ';' before 'int' siruribinare.cpp:28:16: error: expected unqualified-id before '[' token int[] sp1 = new int[101]; ^ siruribinare.cpp:29:16: error: expected unqualified-id before '[' token int[] sp2 = new int[101]; ^ siruribinare.cpp:31:13: error: 'sp1' was not declared in this scope sp1[1] = d[0,1]; sp2[1] = d[1,1]; ^ siruribinare.cpp:31:22: error: 'd' was not declared in this scope sp1[1] = d[0,1]; sp2[1] = d[1,1]; ^ siruribinare.cpp:31:26: warning: left operand of comma operator has no effect [-Wunused-value] sp1[1] = d[0,1]; sp2[1] = d[1,1]; ^ siruribinare.cpp:31:30: error: 'sp2' was not declared in this scope sp1[1] = d[0,1]; sp2[1] = d[1,1]; ^ siruribinare.cpp:31:43: warning: left operand of comma operator has no effect [-Wunused-value] sp1[1] = d[0,1]; sp2[1] = d[1,1]; ^ siruribinare.cpp:35:41: warning: left operand of comma operator has no effect [-Wunused-value] sp1[i] = sp1[i-1] + d[0,i]; ^ siruribinare.cpp:36:41: warning: left operand of comma operator has no effect [-Wunused-value] sp2[i] = sp2[i-1] + d[1,i]; ^ siruribinare.cpp:56:13: error: 'fout' was not declared in this scope fout.WriteLine(ii + " " + jj + " "); ^ siruribinare.cpp:56:44: error: invalid operands of types 'const char*' and 'const char [2]' to binary 'operator+' fout.WriteLine(ii + " " + jj + " "); ^ siruribinare.cpp:57:13: error: 'fin' was not declared in this scope fin.Close(); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema SiruriBinare face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
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ă.