#3975
Dându-se N intervale [a, b], calculați numărul maxim de astfel de intervale care se intersectează în cel puțin un punct.
ad-hoc
| Problema | Intervale_AB | Operații I/O |
intervale.in/intervale.out
|
|---|---|---|---|
| Limita timp | 0.4 secunde | Limita memorie |
Total: 16 MB
/
Stivă 8 MB
|
| Id soluție | #64127769 | Utilizator | |
| Fișier | intervale_ab.cpp | Dimensiune | 920 B |
| Data încărcării | 19 Aprilie 2026, 11:59 | Scor/rezultat | Eroare de compilare |
intervale_ab.cpp:16:7: error: expected identifier before numeric constant 16 | Event[200001]; | ^~~~~~ intervale_ab.cpp:16:7: error: expected ‘]’ before numeric constant 16 | Event[200001]; | ^~~~~~ | ] intervale_ab.cpp:16:6: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 16 | Event[200001]; | ^ intervale_ab.cpp:16:6: error: structured binding declaration cannot have type ‘Event’ intervale_ab.cpp:16:6: note: type must be cv-qualified ‘auto’ or reference to cv-qualified ‘auto’ intervale_ab.cpp:16:6: error: empty structured binding declaration intervale_ab.cpp:16:14: error: expected initializer before ‘;’ token 16 | Event[200001]; | ^ intervale_ab.cpp: In function ‘int main()’: intervale_ab.cpp:22:1: error: expected ‘,’ or ‘;’ before ‘ofstream’ 22 | ofstream fout("intervale.out") | ^~~~~~~~ intervale_ab.cpp:26:7: error: ‘n’ was not declared in this scope 26 | fin>>n; | ^ intervale_ab.cpp:33:9: error: ‘v’ was not declared in this scope 33 | v[k].x = a; v[k].tip = 1; k++; | ^ intervale_ab.cpp:33:11: error: ‘k’ was not declared in this scope 33 | v[k].x = a; v[k].tip = 1; k++; | ^ intervale_ab.cpp:40:29: error: ‘k’ was not declared in this scope 40 | for (int j = 0; j < k ; j++) { | ^ intervale_ab.cpp:41:22: error: ‘v’ was not declared in this scope 41 | if ( v[j].x < v[poz].x || (v[j].x == v[poz].x && v[j].tip > v[poz].tip)) | ^ intervale_ab.cpp:47:11: error: expected unqualified-id before ‘=’ token 47 | Event = aux; | ^ intervale_ab.cpp:48:9: error: ‘v’ was not declared in this scope 48 | v[i] = v[poz]; | ^ intervale_ab.cpp:49:18: error: ‘aux’ was not declared in this scope 49 | v[poz] = aux; | ^~~ intervale_ab.cpp:57:12: error: ‘v’ was not declared in this scope 57 | cur += v[i].tip; | ^ intervale_ab.cpp:61:5: error: ‘fout’ was not declared in this scope 61 | fout << mx; | ^~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Intervale_AB 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ă.