#4815
Se consideră șirul de litere mici ale alfabetului englez A[1], ..., A[N]
.
Fie succesiunea de caractere alăturate din șir A[x], A[x + 1], ..., A[y]
, unde 1 ≤ x ≤ y ≤ N
, pe care o notăm cu A[x, y]
. Pentru oricare literă mică a alfabetului englez l
, definim range(l)
ca fiind 0
, dacă l
apare cel mult o dată în A[x, y]
. Altfel, valoarea range(l)
este egală cu diferența dintre cea mai mare și cea mai mică poziție pe care litera l
apare în A[x, y]
.
Șirul suport asociat lui A[x, y]
este șirul de caractere minim lexicografic ce conține fiecare literă l
de range(l)
ori. Asupra șirului se efectuează două tipuri de operații:
c
și poziția poz
, se înlocuiește A[poz]
cu c
.x, y
, se generează șirul suport al lui A[x, y]
.C = 1
: determinați șirul suport minim lexicografic dintre cele obținute în urma tuturor operațiilor de generare.C = 2
: pentru fiecare operație de generare dată, determinați numărul de anagrame distincte ale șirului suport obținut, modulo 1999999973
.Problema | anagrame6 | Operații I/O |
![]() anagrame.in /anagrame.out
|
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 256 MB
/
Stivă 64 MB
|
Id soluție | #57793375 | Utilizator | |
Fișier | anagrame6.cpp | Dimensiune | 5.13 KB |
Data încărcării | 16 Aprilie 2025, 17:31 | Scor / rezultat | Eroare de compilare |
anagrame6.cpp: In function 'int getInt(std::string)': anagrame6.cpp:49:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 1; i < x.size(); ++i) { ^ anagrame6.cpp: At global scope: anagrame6.cpp:117:14: error: redefinition of 'std::ifstream fin' ifstream cin ("anagrame.in"); ^ anagrame6.cpp:2:13: error: 'std::ifstream fin' previously declared here #define cin fin ^ anagrame6.cpp:5:10: note: in expansion of macro 'cin' ifstream cin ("anagrame.in"); ^ anagrame6.cpp:118:15: error: redefinition of 'std::ofstream fout' ofstream cout ("anagrame.out"); ^ anagrame6.cpp:3:14: error: 'std::ofstream fout' previously declared here #define cout fout ^ anagrame6.cpp:6:10: note: in expansion of macro 'cout' ofstream cout ("anagrame.out"); ^ anagrame6.cpp:120:14: error: redefinition of 'char s [100001]' char s[100001]; ^ anagrame6.cpp:8:6: error: 'char s [100001]' previously declared here char s[100001]; ^ anagrame6.cpp:121:5: error: redefinition of 'int n' int n, m, cer, fact[100001]; ^ anagrame6.cpp:9:5: error: 'int n' previously declared here int n, m, cer, fact[100001]; ^ anagrame6.cpp:121:8: error: redefinition of 'int m' int n, m, cer, fact[100001]; ^ anagrame6.cpp:9:8: error: 'int m' previously declared here int n, m, cer, fact[100001]; ^ anagrame6.cpp:121:11: error: redefinition of 'int cer' int n, m, cer, fact[100001]; ^ anagrame6.cpp:9:11: error: 'int cer' previously declared here int n, m, cer, fact[100001]; ^ anagrame6.cpp:121:27: error: redefinition of 'int fact [100001]' int n, m, cer, fact[100001]; ^ anagrame6.cpp:9:16: error: 'int fact [100001]' previously declared here int n, m, cer, fact[100001]; ^ anagrame6.cpp:122:11: error: redefinition of 'const int mod' const int mod = 1999999973; ^ anagrame6.cpp:10:11: error: 'const int mod' previously defined here const int mod = 1999999973; ^ anagrame6.cpp:123:13: error: redefinition of 'std::vector<int> bestRange' vector<int> bestRange; ^ anagrame6.cpp:11:13: error: 'std::vector<int> bestRange' previously declared here vector<int> bestRange; ^ anagrame6.cpp: In function 'int lgput(int, int)': anagrame6.cpp:125:5: error: redefinition of 'int lgput(int, int)' int lgput (int a, int b) { ^ anagrame6.cpp:13:5: error: 'int lgput(int, int)' previously defined here int lgput (int a, int b) { ^ anagrame6.cpp: In function 'int getModes(std::vector<int>)': anagrame6.cpp:136:5: error: redefinition of 'int getModes(std::vector<int>)' int getModes(vector<int> a) { ^ anagrame6.cpp:24:5: error: 'int getModes(std::vector<int>)' previously defined here int getModes(vector<int> a) { ^ anagrame6.cpp: In function 'int compare(std::vector<int>, std::vector<int>)': anagrame6.cpp:149:5: error: redefinition of 'int compare(std::vector<int>, std::vector<int>)' int compare (vector<int> a, vector<int> b) { ^ anagrame6.cpp:37:5: error: 'int compare(std::vector<int>, std::vector<int>)' previously defined here int compare (vector<int> a, vector<int> b) { ^ anagrame6.cpp: In function 'int getInt(std::string)': anagrame6.cpp:159:5: error: redefinition of 'int getInt(std::string)' int getInt(string x) { ^ anagrame6.cpp:47:5: error: 'int getInt(std::string)' previously defined here int getInt(string x) { ^ anagrame6.cpp:161:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 1; i < x.size(); ++i) { ^ anagrame6.cpp: In function 'void getSir(int, int)': anagrame6.cpp:166:6: error: redefinition of 'void getSir(int, int)' void getSir (int st, int dr) { ^ anagrame6.cpp:54:6: error: 'void getSir(int, int)' previously defined here void getSir (int st, int dr) { ^ anagrame6.cpp: In function 'int main()': anagrame6.cpp:194:5: error: redefinition of 'int main()' int main() { ^ anagrame6.cpp:82:5: error: 'int main()' previously defined here int main() { ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema anagrame6 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ă.