#353
Spectacole
La un festival sunt programate n
spectacole. Pentru fiecare se cunoaște momentul de început și momentul de sfârșit, exprimate prin numere naturale. Un spectator dorește să urmărească cât mai multe spectacole în întregime.
Determinați numărul maxim de spectacole care pot fi urmărite, fără ca acestea să se suprapună.
Problema | Spectacole | Operații I/O |
![]() spectacole.in /spectacole.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #43591104 | Utilizator | |
Fișier | spectacole.cpp | Dimensiune | 1.16 KB |
Data încărcării | 04 Mai 2023, 19:46 | Scor / rezultat | Eroare de compilare |
spectacole.cpp:1:9: error: #include expects "FILENAME" or <FILENAME> #include<fstream> ^ spectacole.cpp:11:1: error: stray '\302' in program { fin>>n; //nr de spectacole ^ spectacole.cpp:11:1: error: stray '\240' in program spectacole.cpp:12:1: error: stray '\302' in program for(int i=1;i<=n;i++) ^ spectacole.cpp:12:1: error: stray '\240' in program spectacole.cpp:13:1: error: stray '\302' in program { fin>>x[i].in>>x[i].sf; ^ spectacole.cpp:13:1: error: stray '\240' in program spectacole.cpp:13:1: error: stray '\302' in program spectacole.cpp:13:1: error: stray '\240' in program spectacole.cpp:13:1: error: stray '\302' in program spectacole.cpp:13:1: error: stray '\240' in program spectacole.cpp:14:1: error: stray '\302' in program x[i].ord=i; //retin numarul de ordine al spectacolului ^ spectacole.cpp:14:1: error: stray '\240' in program spectacole.cpp:14:1: error: stray '\302' in program spectacole.cpp:14:1: error: stray '\240' in program spectacole.cpp:14:1: error: stray '\302' in program spectacole.cpp:14:1: error: stray '\240' in program spectacole.cpp:14:1: error: stray '\302' in program spectacole.cpp:14:1: error: stray '\240' in program spectacole.cpp:15:1: error: stray '\302' in program } ^ spectacole.cpp:15:1: error: stray '\240' in program spectacole.cpp:15:1: error: stray '\302' in program spectacole.cpp:15:1: error: stray '\240' in program spectacole.cpp:18:1: error: stray '\302' in program { ^ spectacole.cpp:18:1: error: stray '\240' in program spectacole.cpp:19:1: error: stray '\302' in program for(int i=1;i<=n-1;i++) ^ spectacole.cpp:19:1: error: stray '\240' in program spectacole.cpp:20:1: error: stray '\302' in program for(int j=i+1;j<=n;j++) ^ spectacole.cpp:20:1: error: stray '\240' in program spectacole.cpp:20:1: error: stray '\302' in program spectacole.cpp:20:1: error: stray '\240' in program spectacole.cpp:21:1: error: stray '\302' in program if (x[i].sf>x[j].sf) //sortez spectacolele crescator dupa ora terminarii ^ spectacole.cpp:21:1: error: stray '\240' in program spectacole.cpp:21:1: error: stray '\302' in program spectacole.cpp:21:1: error: stray '\240' in program spectacole.cpp:21:1: error: stray '\302' in program spectacole.cpp:21:1: error: stray '\240' in program spectacole.cpp:21:1: error: stray '\302' in program spectacole.cpp:21:1: error: stray '\240' in program spectacole.cpp:22:1: error: stray '\302' in program swap(x[i],x[j]); ^ spectacole.cpp:22:1: error: stray '\240' in program spectacole.cpp:22:1: error: stray '\302' in program spectacole.cpp:22:1: error: stray '\240' in program spectacole.cpp:22:1: error: stray '\302' in program spectacole.cpp:22:1: error: stray '\240' in program spectacole.cpp:22:1: error: stray '\302' in program spectacole.cpp:22:1: error: stray '\240' in program spectacole.cpp:26:1: error: stray '\302' in program i=2; ^ spectacole.cpp:26:1: error: stray '\240' in program spectacole.cpp:27:1: error: stray '\302' in program oraprog=x[1].sf; //retin ora de sfarsit a spectacolului anterior care e deja programat ^ spectacole.cpp:27:1: error: stray '\240' in program spectacole.cpp:28:1: error: stray '\302' in program while (i<=n) //cat timp nu s-au analizat toate spectacolele ^ spectacole.cpp:28:1: error: stray '\240' in program spectacole.cpp:29:1: error: stray '\302' in program { if (x[i].in>=oraprog) //aleg acel spectacol care incepe dupa ce s-a terminat cel anterior lui ^ spectacole.cpp:29:1: error: stray '\240' in program spectacole.cpp:30:1: error: stray '\302' in program { k++; ^ spectacole.cpp:30:1: error: stray '\240' in program spectacole.cpp:30:1: error: stray '\302' in program spectacole.cpp:30:1: error: stray '\240' in program spectacole.cpp:30:1: error: stray '\302' in program spectacole.cpp:30:1: error: stray '\240' in program spectacole.cpp:31:1: error: stray '\302' in program oraprog=x[i].sf; //retin ora terminarii ultimului spectacol programat ^ spectacole.cpp:31:1: error: stray '\240' in program spectacole.cpp:31:1: error: stray '\302' in program spectacole.cpp:31:1: error: stray '\240' in program spectacole.cpp:31:1: error: stray '\302' in program spectacole.cpp:31:1: error: stray '\240' in program spectacole.cpp:31:1: error: stray '\302' in program spectacole.cpp:31:1: error: stray '\240' in program spectacole.cpp:32:1: error: stray '\302' in program } ^ spectacole.cpp:32:1: error: stray '\240' in program spectacole.cpp:32:1: error: stray '\302' in program spectacole.cpp:32:1: error: stray '\240' in program spectacole.cpp:32:1: error: stray '\302' in program spectacole.cpp:32:1: error: stray '\240' in program spectacole.cpp:33:1: error: stray '\302' in program i++; //trec la urmatorul spectacol ^ spectacole.cpp:33:1: error: stray '\240' in program spectacole.cpp:33:1: error: stray '\302' in program spectacole.cpp:33:1: error: stray '\240' in program spectacole.cpp:34:1: error: stray '\302' in program } ^ spectacole.cpp:34:1: error: stray '\240' in program spectacole.cpp:35:1: error: stray '\302' in program fout<<k; ^ spectacole.cpp:35:1: error: stray '\240' in program spectacole.cpp:39:1: error: stray '\302' in program citire(); ^ spectacole.cpp:39:1: error: stray '\240' in program spectacole.cpp:40:1: error: stray '\302' in program sortare(); ^ spectacole.cpp:40:1: error: stray '\240' in program spectacole.cpp:41:1: error: stray '\302' in program greedy(); ^ spectacole.cpp:41:1: error: stray '\240' in program spectacole.cpp:43:1: error: stray '\302' in program return 0; ^ spectacole.cpp:43:1: error: stray '\240' in program spectacole.cpp:3:1: error: 'ifstream' does not name a type ifstream fin("spectacole.in"); ^ spectacole.cpp:3:20: error: 'spectacole' does not name a type ifstream fin("spectacole.in"); ^ spectacole.cpp:3:39: error: expected unqualified-id before ')' token ifstream fin("spectacole.in"); ^ spectacole.cpp:4:1: error: 'ofstream' does not name a type ofstream fout("spectacole.out"); ^ spectacole.cpp:4:21: error: 'spectacole' does not name a type ofstream fout("spectacole.out"); ^ spectacole.cpp:4:41: error: expected unqualified-id before ')' token ofstream fout("spectacole.out"); ^ spectacole.cpp: In function 'void citire()': spectacole.cpp:11:3: error: 'fin' was not declared in this scope { fin>>n; //nr de spectacole ^ spectacole.cpp:12:18: error: 'lt' was not declared in this scope for(int i=1;i<=n;i++) ^ spectacole.cpp:12:21: error: expected primary-expression before '=' token for(int i=1;i<=n;i++) ^ spectacole.cpp:12:23: error: expected ')' before ';' token for(int i=1;i<=n;i++) ^ spectacole.cpp:12:27: error: expected ';' before ')' token for(int i=1;i<=n;i++) ^ spectacole.cpp: In function 'void sortare()': spectacole.cpp:19:18: error: 'lt' was not declared in this scope for(int i=1;i<=n-1;i++) ^ spectacole.cpp:19:21: error: expected primary-expression before '=' token for(int i=1;i<=n-1;i++) ^ spectacole.cpp:19:25: error: expected ')' before ';' token for(int i=1;i<=n-1;i++) ^ spectacole.cpp:19:29: error: expected ';' before ')' token for(int i=1;i<=n-1;i++) ^ spectacole.cpp:20:21: error: 'j' was not declared in this scope for(int j=i+1;j<=n;j++) ^ spectacole.cpp:20:23: error: 'lt' was not declared in this scope for(int j=i+1;j<=n;j++) ^ spectacole.cpp:20:26: error: expected primary-expression before '=' token for(int j=i+1;j<=n;j++) ^ spectacole.cpp:20:32: error: expected ';' before ')' token for(int j=i+1;j<=n;j++) ^ spectacole.cpp: In function 'void greedy()': spectacole.cpp:35:4: error: 'fout' was not declared in this scope fout<<k; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Spectacole 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ă.