#205
Se citeşte un număr natural nenul n şi o permutare a mulţimii M={1,2,..,n}. Să se afişeze, în ordine lexicografică, toate permutările mulţimii M care nu conţin elemente alăturate care au fost alăturate şi în permutarea dată.
| Problema | Shuffle | Operații I/O |
shuffle.in/shuffle.out
|
|---|---|---|---|
| Limita timp | 0.5 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64472338 | Utilizator | |
| Fișier | shuffle.cpp | Dimensiune | 2.83 KB |
| Data încărcării | 09 Mai 2026, 00:01 | Scor/rezultat | Eroare de compilare |
shuffle.cpp:1:7: error: expected nested-name-specifier before ‘System’ 1 | using System; | ^~~~~~ shuffle.cpp:2:7: error: expected nested-name-specifier before ‘System’ 2 | using System.IO; | ^~~~~~ shuffle.cpp:3:7: error: expected nested-name-specifier before ‘System’ 3 | using System.Text; | ^~~~~~ shuffle.cpp:8:15: error: expected unqualified-id before ‘[’ token 8 | static int[] a; | ^ shuffle.cpp:9:16: error: expected unqualified-id before ‘[’ token 9 | static bool[,] adj; | ^ shuffle.cpp:10:15: error: expected unqualified-id before ‘[’ token 10 | static int[] sol; | ^ shuffle.cpp:11:16: error: expected unqualified-id before ‘[’ token 11 | static bool[] viz; | ^ shuffle.cpp:12:17: error: ISO C++ forbids in-class initialization of non-const static member ‘Program::found’ 12 | static bool found = false; | ^~~~~ shuffle.cpp:13:12: error: ‘StringBuilder’ does not name a type 13 | static StringBuilder output = new StringBuilder(); | ^~~~~~~~~~~~~ shuffle.cpp:81:2: error: expected ‘;’ after class definition 81 | } | ^ | ; shuffle.cpp: In static member function ‘static void Program::Main()’: shuffle.cpp:17:15: error: expected nested-name-specifier before ‘(’ token 17 | using (FileStream fs = File.OpenRead("shuffle.in")) | ^ shuffle.cpp:37:13: error: ‘adj’ was not declared in this scope 37 | adj[a[i], a[i + 1]] = true; | ^~~ shuffle.cpp:37:17: error: ‘a’ was not declared in this scope 37 | adj[a[i], a[i + 1]] = true; | ^ shuffle.cpp:43:13: error: ‘File’ was not declared in this scope 43 | File.WriteAllText("shuffle.out", "nu exista\n"); | ^~~~ shuffle.cpp:47:13: error: ‘File’ was not declared in this scope 47 | File.WriteAllText("shuffle.out", output.ToString()); | ^~~~ shuffle.cpp:47:46: error: ‘output’ was not declared in this scope 47 | File.WriteAllText("shuffle.out", output.ToString()); | ^~~~~~ shuffle.cpp: In static member function ‘static void Program::Bkt(int)’: shuffle.cpp:55:18: error: ‘viz’ was not declared in this scope 55 | if (!viz[i]) | ^~~ shuffle.cpp:57:30: error: ‘adj’ was not declared in this scope 57 | if (k > 1 && adj[sol[k - 1], i]) | ^~~ shuffle.cpp:57:34: error: ‘sol’ was not declared in this scope 57 | if (k > 1 && adj[sol[k - 1], i]) | ^~~ shuffle.cpp:60:17: error: ‘sol’ was not declared in this scope 60 | sol[k] = i; | ^~~ shuffle.cpp:68:25: error: ‘output’ was not declared in this scope 68 | output.Append(sol[j]).Append(j == n ? "" : " "); | ^~~~~~ shuffle.cpp:70:21: error: ‘output’ was not declared in this scope 70 | output.AppendLine(); | ^~~~~~ shuffle.cpp: At global scope: shuffle.cpp:85:12: error: expected ‘:’ before ‘readonly’ 85 | private readonly Stream stream; | ^~~~~~~~~ | : shuffle.cpp:85:13: error: ‘readonly’ does not name a type 85 | private readonly Stream stream; | ^~~~~~~~ shuffle.cpp:86:12: error: expected ‘:’ before ‘readonly’ 86 | private readonly byte[] buffer = new byte[1 << 16]; | ^~~~~~~~~ | : shuffle.cpp:86:13: error: ‘readonly’ does not name a type 86 | private readonly byte[] buffer = new byte[1 << 16]; | ^~~~~~~~ shuffle.cpp:87:12: error: expected ‘:’ before ‘int’ 87 | private int length; | ^~~~ | : shuffle.cpp:88:12: error: expected ‘:’ before ‘int’ 88 | private int index; | ^~~~ | : shuffle.cpp:90:11: error: expected ‘:’ before ‘Scanner’ 90 | public Scanner(Stream stream) | ^~~~~~~~ | : shuffle.cpp:90:26: error: expected ‘)’ before ‘stream’ 90 | public Scanner(Stream stream) | ~ ^~~~~~~ | ) shuffle.cpp:95:12: error: expected ‘:’ before ‘int’ 95 | private int Read() | ^~~~ | : shuffle.cpp:106:11: error: expected ‘:’ before ‘int’ 106 | public int NextInt() | ^~~~ | : shuffle.cpp:130:2: error: expected ‘;’ after class definition 130 | } | ^ | ; shuffle.cpp: In member function ‘int Scanner::Read()’: shuffle.cpp:99:22: error: ‘stream’ was not declared in this scope 99 | length = stream.Read(buffer, 0, buffer.Length); | ^~~~~~ shuffle.cpp:99:34: error: ‘buffer’ was not declared in this scope 99 | length = stream.Read(buffer, 0, buffer.Length); | ^~~~~~ shuffle.cpp:103:16: error: ‘buffer’ was not declared in this scope 103 | return buffer[index++]; | ^~~~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Shuffle 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ă.