#4342
pdif
Cunoscând numerele naturale n
reprezentând numărul de numere din șir și c
reprezentând cerința (1
sau 2
) și un șir de n
numere naturale, se cere să se rezolve următoarele cerințe:
1. dacă c = 1
, atunci se cere să se afișeze lungimea maximă a unei secvențe p-dif și numărul de secvențe p-dif de lungime maximă din șir.
2. dacă c = 2
, atunci se cere să se afișeze valorile st
și dr
, reprezentând poziția de început, respectiv de sfârșit a primei secvențe p-dif de lungime maximă.
Olimpiada Municipală de Informatică, Iași, 2023
Problema | pdif | Operații I/O |
pdif.in /pdif.out
|
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 10 MB
/
Stivă 2 MB
|
Id soluție | #50736858 | Utilizator | |
Fișier | pdif.cpp | Dimensiune | 2.04 KB |
Data încărcării | 26 Aprilie 2024, 18:17 | Scor / rezultat | Eroare de compilare |
pdif.cpp:12:13: error: redefinition of 'std::ifstream cin' ifstream cin("pdif.in"); ^ pdif.cpp:4:10: error: 'std::ifstream cin' previously declared here ifstream cin("pdif.in"); ^ pdif.cpp:13:14: error: redefinition of 'std::ofstream cout' ofstream cout("pdif.out"); ^ pdif.cpp:5:10: error: 'std::ofstream cout' previously declared here ofstream cout("pdif.out"); ^ pdif.cpp:15:5: error: redefinition of 'int n' int n, c, x, y, lg, lgmax, ap, s, d, st, dr; ^ pdif.cpp:7:5: error: 'int n' previously declared here int n, c, x, y, lg, lgmax, ap, s, d, st, dr; ^ pdif.cpp:15:8: error: redefinition of 'int c' int n, c, x, y, lg, lgmax, ap, s, d, st, dr; ^ pdif.cpp:7:8: error: 'int c' previously declared here int n, c, x, y, lg, lgmax, ap, s, d, st, dr; ^ pdif.cpp:15:11: error: redefinition of 'int x' int n, c, x, y, lg, lgmax, ap, s, d, st, dr; ^ pdif.cpp:7:11: error: 'int x' previously declared here int n, c, x, y, lg, lgmax, ap, s, d, st, dr; ^ pdif.cpp:15:14: error: redefinition of 'int y' int n, c, x, y, lg, lgmax, ap, s, d, st, dr; ^ pdif.cpp:7:14: error: 'int y' previously declared here int n, c, x, y, lg, lgmax, ap, s, d, st, dr; ^ pdif.cpp:15:17: error: redefinition of 'int lg' int n, c, x, y, lg, lgmax, ap, s, d, st, dr; ^ pdif.cpp:7:17: error: 'int lg' previously declared here int n, c, x, y, lg, lgmax, ap, s, d, st, dr; ^ pdif.cpp:15:21: error: redefinition of 'int lgmax' int n, c, x, y, lg, lgmax, ap, s, d, st, dr; ^ pdif.cpp:7:21: error: 'int lgmax' previously declared here int n, c, x, y, lg, lgmax, ap, s, d, st, dr; ^ pdif.cpp:15:28: error: redefinition of 'int ap' int n, c, x, y, lg, lgmax, ap, s, d, st, dr; ^ pdif.cpp:7:28: error: 'int ap' previously declared here int n, c, x, y, lg, lgmax, ap, s, d, st, dr; ^ pdif.cpp:15:32: error: redefinition of 'int s' int n, c, x, y, lg, lgmax, ap, s, d, st, dr; ^ pdif.cpp:7:32: error: 'int s' previously declared here int n, c, x, y, lg, lgmax, ap, s, d, st, dr; ^ pdif.cpp:15:35: error: redefinition of 'int d' int n, c, x, y, lg, lgmax, ap, s, d, st, dr; ^ pdif.cpp:7:35: error: 'int d' previously declared here int n, c, x, y, lg, lgmax, ap, s, d, st, dr; ^ pdif.cpp:15:38: error: redefinition of 'int st' int n, c, x, y, lg, lgmax, ap, s, d, st, dr; ^ pdif.cpp:7:38: error: 'int st' previously declared here int n, c, x, y, lg, lgmax, ap, s, d, st, dr; ^ pdif.cpp:15:42: error: redefinition of 'int dr' int n, c, x, y, lg, lgmax, ap, s, d, st, dr; ^ pdif.cpp:7:42: error: 'int dr' previously declared here int n, c, x, y, lg, lgmax, ap, s, d, st, dr; ^ pdif.cpp: In function 'int main()': pdif.cpp:68:5: error: redefinition of 'int main()' int main() ^ pdif.cpp:26:5: error: 'int main()' previously defined here int main() ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema pdif 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ă.