#3471
Se dau două numere naturale N și M. Se consideră un șir de numere de lungime N indexat de la 0 căruia trebuie să i se atribuie valori astfel încât să se respecte M restricții de forma:
0 i val1 val2 - elementul i poate avea doar valoarea val1 sau val2
1 i j val – fix unul dintre elementele de pe pozițiile i și j trebuie să aibă valoarea val
2 i j – elementele de pe pozițiile i și j trebuie să aibă valori diferite
3 i j – elementele de pe pozițiile i și j trebuie să aibă aceeași valoare
Determinați o atribuire de valori asupra șirului astfel încât acesta să respecte cele M restricții.
Info-Oltenia 2020, Clasele XI-XII
| Problema | valori1 | Operații I/O |
valori.in/valori.out
|
|---|---|---|---|
| Limita timp | 1 secunde | Limita memorie |
Total: 32 MB
/
Stivă 8 MB
|
| Id soluție | #57277970 | Utilizator | |
| Fișier | valori1.cpp | Dimensiune | 7.07 KB |
| Data încărcării | 23 Martie 2025, 23:28 | Scor/rezultat | 95 puncte |
valori1.cpp: In function 'void bt()': valori1.cpp:94:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] } while(st[j] < nodes[j].size() && !valid(j)); ^ valori1.cpp:96:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if(st[j] == nodes[j].size() || !valid(j)) ^ valori1.cpp: In function 'int main()': valori1.cpp:117:46: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i = 0; i < nodes[a].size(); ++i) ^ valori1.cpp:118:50: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int j = 0; j < nodes[b].size(); ++j) ^ valori1.cpp:123:50: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i = 0; i < nodes[a].size(); ++i) ^ valori1.cpp:124:54: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int j = 0; j < nodes[b].size(); ++j) ^ valori1.cpp:131:46: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i = 0; i < nodes[a].size(); ++i) ^ valori1.cpp:132:50: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int j = 0; j < nodes[b].size(); ++j) ^ valori1.cpp:140:46: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i = 0; i < nodes[a].size(); ++i) ^ valori1.cpp:143:46: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i = 0; i < nodes[b].size(); ++i) ^ valori1.cpp:148:50: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i = 0; i < nodes[a].size(); ++i) ^ valori1.cpp:152:50: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i = 0; i < nodes[b].size(); ++i) ^ valori1.cpp:183:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i = 0; i < nodes[a].size(); ++i) ^ valori1.cpp:184:46: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int j = 0; j < nodes[b].size(); ++j) ^ valori1.cpp:189:46: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i = 0; i < nodes[a].size(); ++i) ^ valori1.cpp:190:50: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int j = 0; j < nodes[b].size(); ++j) ^ valori1.cpp:197:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i = 0; i < nodes[a].size(); ++i) ^ valori1.cpp:198:46: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int j = 0; j < nodes[b].size(); ++j) ^ valori1.cpp:206:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i = 0; i < nodes[a].size(); ++i) ^ valori1.cpp:209:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i = 0; i < nodes[b].size(); ++i) ^ valori1.cpp:214:46: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i = 0; i < nodes[a].size(); ++i) ^ valori1.cpp:218:46: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i = 0; i < nodes[b].size(); ++i) ^ valori1.cpp:227:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int j = 0; j < nodes[res.a].size(); ++j) { ^
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0 secunde | Corect | 5 | 5 | ||
| 2 | 0 secunde | Corect | 5 | 5 | ||
| 3 | 0 secunde | Corect | 5 | 5 | ||
| 4 | 0 secunde | Corect | 5 | 5 | ||
| 5 | 0 secunde | Corect | 5 | 5 | ||
| 6 | 0.02 secunde | Corect | 5 | 5 | ||
| 7 | Depășit | Limita de timp depășită | 5 | 0 | ||
| 8 | 0.004 secunde | Corect | 5 | 5 | ||
| 9 | 0 secunde | Corect | 5 | 5 | ||
| 10 | 0.02 secunde | Corect | 5 | 5 | ||
| 11 | 0.02 secunde | Corect | 5 | 5 | ||
| 12 | 0.02 secunde | Corect | 5 | 5 | ||
| 13 | 0.02 secunde | Corect | 5 | 5 | ||
| 14 | 0.02 secunde | Corect | 5 | 5 | ||
| 15 | 0.02 secunde | Corect | 5 | 5 | ||
| 16 | 0.02 secunde | Corect | 5 | 5 | ||
| 17 | 0.02 secunde | Corect | 5 | 5 | ||
| 18 | 0.02 secunde | Corect | 5 | 5 | ||
| 19 | 0.02 secunde | Corect | 10 | 10 | ||
| Punctaj total | 95 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema valori1 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ă.