#4228
permsort
Grădinarul Marian are la dispoziţie o permutare cu n
elemente şi un număr natural S
care iniţial are valoarea 0
. Marian execută n
operaţii de forma:
x
a minimului din permutareS
pe x
.Determinaţi valoarea lui S
după ce grădinarul Marian termină de executat toate cele n
operaţii.
Lot Botosani 2012
Problema | permsort | Operații I/O |
![]() permsort.in /permsort.out
|
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 128 MB
/
Stivă 64 MB
|
Id soluție | #44303728 | Utilizator | |
Fișier | permsort.cpp | Dimensiune | 947 B |
Data încărcării | 29 Iulie 2023, 15:23 | Scor / rezultat | Eroare de compilare |
permsort.cpp:3:5: error: 'vector' does not name a type vector<char> str; ^ permsort.cpp:5:5: error: 'ifstream' does not name a type ifstream fin; ^ permsort.cpp: In member function 'char InParser::getChar()': permsort.cpp:8:24: error: 'str' was not declared in this scope if (ptr == int(str.size())) { ^ permsort.cpp:9:13: error: 'fin' was not declared in this scope fin.read(str.data(), str.size()); ^ permsort.cpp:12:16: error: 'str' was not declared in this scope return str[ptr++]; ^ permsort.cpp: In member function 'T InParser::getInt()': permsort.cpp:18:28: error: there are no arguments to 'isdigit' that depend on a template parameter, so a declaration of 'isdigit' must be available [-fpermissive] while (!isdigit(chr) && chr != '-') ^ permsort.cpp:18:28: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) permsort.cpp:26:27: error: there are no arguments to 'isdigit' that depend on a template parameter, so a declaration of 'isdigit' must be available [-fpermissive] while (isdigit(chr)) { ^ permsort.cpp: In constructor 'InParser::InParser(const char*)': permsort.cpp:34:34: error: class 'InParser' does not have any field named 'str' InParser(const char* name) : str(1e5), ptr(str.size()), fin(name) { } ^ permsort.cpp:34:48: error: 'str' was not declared in this scope InParser(const char* name) : str(1e5), ptr(str.size()), fin(name) { } ^ permsort.cpp:34:61: error: class 'InParser' does not have any field named 'fin' InParser(const char* name) : str(1e5), ptr(str.size()), fin(name) { } ^ permsort.cpp: In destructor 'InParser::~InParser()': permsort.cpp:35:19: error: 'fin' was not declared in this scope ~InParser() { fin.close(); } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema permsort 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ă.