#4337
Se dă un șir de n numere întregi a = (a[1], a[2], ..., a[n]). Trebuie să construiți un nou vector b de lungime n în care valorile sunt cuprinse între 1 și n astfel: toate elementele a[i] care memorează valoarea minimă se înlocuiesc în b[i] cu 1, toate elementele a[j] imediat mai mari decât minimele se înlocuiesc în b[j] cu 2, ș.a.m.d.
Folclorul informatic
| Problema | normalizare | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.3 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #63857704 | Utilizator | |
| Fișier | normalizare.cpp | Dimensiune | 1.70 KB |
| Data încărcării | 23 Martie 2026, 09:38 | Scor/rezultat | Eroare de compilare |
normalizare.cpp:19:17: error: ISO C++ forbids declaration of 'comp' with no type [-fpermissive] comp(rah a,rah b) ^ normalizare.cpp:24:16: error: ISO C++ forbids declaration of 'com' with no type [-fpermissive] com(rah a,rah b) ^ normalizare.cpp: In function 'int main()': normalizare.cpp:30:11: warning: unused variable 'j' [-Wunused-variable] int i,j,n,cnt; ^ normalizare.cpp: At global scope: normalizare.cpp:68:13: error: redefinition of 'std::ifstream fin' ifstream fin("ratc2.in"); ^ normalizare.cpp:7:10: error: 'std::ifstream fin' previously declared here ifstream fin("ratc2.in"); ^ normalizare.cpp:69:14: error: redefinition of 'std::ofstream fout' ofstream fout("ratc2.out"); ^ normalizare.cpp:8:10: error: 'std::ofstream fout' previously declared here ofstream fout("ratc2.out"); ^ normalizare.cpp:72:8: error: redefinition of 'struct rah' struct rah ^ normalizare.cpp:11:8: error: previous definition of 'struct rah' struct rah ^ normalizare.cpp:78:11: error: invalid type in declaration before ';' token }v[100001]; ^ normalizare.cpp:78:11: error: conflicting declaration 'int v [100001]' normalizare.cpp:17:2: error: 'v' has a previous declaration as 'rah v [100001]' }v[100001]; ^ normalizare.cpp: In function 'bool comp(rah, rah)': normalizare.cpp:80:22: error: new declaration 'bool comp(rah, rah)' bool comp(rah a,rah b) ^ normalizare.cpp:19:1: error: ambiguates old declaration 'int comp(rah, rah)' comp(rah a,rah b) ^ normalizare.cpp: In function 'bool com(rah, rah)': normalizare.cpp:85:21: error: new declaration 'bool com(rah, rah)' bool com(rah a,rah b) ^ normalizare.cpp:24:1: error: ambiguates old declaration 'int com(rah, rah)' com(rah a,rah b) ^ normalizare.cpp: In function 'int main()': normalizare.cpp:89:5: error: redefinition of 'int main()' int main() ^ normalizare.cpp:28:5: error: 'int main()' previously defined here int main() ^ normalizare.cpp:91:11: warning: unused variable 'j' [-Wunused-variable] int i,j,n,cnt; ^ normalizare.cpp: In function 'int comp(rah, rah)': normalizare.cpp:23:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ normalizare.cpp: In function 'bool comp(rah, rah)': normalizare.cpp:84:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema normalizare 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ă.