#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 | #57266099 | Utilizator | |
| Fișier | valori1.cpp | Dimensiune | 3.09 KB |
| Data încărcării | 23 Martie 2025, 01:42 | Scor/rezultat | Eroare de compilare |
valori1.cpp: In function 'void dis()': valori1.cpp:41:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int k = 0; k < nodes[j].size(); ++k) ^ valori1.cpp: In function 'bool valid()': valori1.cpp:49:17: error: invalid initialization of reference of type 'int&' from expression of type 'const int' for(int &j: cond) ^ valori1.cpp:51:16: error: request for member 't' in 'res', which is of non-class type 'const int' if(res.t == 3) ^ valori1.cpp:52:26: error: request for member 'a' in 'res', which is of non-class type 'const int' if(nodes[res.a][st[res.a]] != nodes[res.b][st[res.b]]) ^ valori1.cpp:52:36: error: request for member 'a' in 'res', which is of non-class type 'const int' if(nodes[res.a][st[res.a]] != nodes[res.b][st[res.b]]) ^ valori1.cpp:52:53: error: request for member 'b' in 'res', which is of non-class type 'const int' if(nodes[res.a][st[res.a]] != nodes[res.b][st[res.b]]) ^ valori1.cpp:52:63: error: request for member 'b' in 'res', which is of non-class type 'const int' if(nodes[res.a][st[res.a]] != nodes[res.b][st[res.b]]) ^ valori1.cpp:54:16: error: request for member 't' in 'res', which is of non-class type 'const int' if(res.t == 2) ^ valori1.cpp:55:26: error: request for member 'a' in 'res', which is of non-class type 'const int' if(nodes[res.a][st[res.a]] == nodes[res.b][st[res.b]]) ^ valori1.cpp:55:36: error: request for member 'a' in 'res', which is of non-class type 'const int' if(nodes[res.a][st[res.a]] == nodes[res.b][st[res.b]]) ^ valori1.cpp:55:53: error: request for member 'b' in 'res', which is of non-class type 'const int' if(nodes[res.a][st[res.a]] == nodes[res.b][st[res.b]]) ^ valori1.cpp:55:63: error: request for member 'b' in 'res', which is of non-class type 'const int' if(nodes[res.a][st[res.a]] == nodes[res.b][st[res.b]]) ^ valori1.cpp:57:16: error: request for member 't' in 'res', which is of non-class type 'const int' if(res.t == 1) ^ valori1.cpp:58:26: error: request for member 'a' in 'res', which is of non-class type 'const int' if(nodes[res.a][st[res.a]] == nodes[res.b][st[res.b]] || (nodes[res.a][st[res.a]] != res.c && nodes[res.b][st[res.b]] != res.c)) ^ valori1.cpp:58:36: error: request for member 'a' in 'res', which is of non-class type 'const int' if(nodes[res.a][st[res.a]] == nodes[res.b][st[res.b]] || (nodes[res.a][st[res.a]] != res.c && nodes[res.b][st[res.b]] != res.c)) ^ valori1.cpp:58:53: error: request for member 'b' in 'res', which is of non-class type 'const int' if(nodes[res.a][st[res.a]] == nodes[res.b][st[res.b]] || (nodes[res.a][st[res.a]] != res.c && nodes[res.b][st[res.b]] != res.c)) ^ valori1.cpp:58:63: error: request for member 'b' in 'res', which is of non-class type 'const int' if(nodes[res.a][st[res.a]] == nodes[res.b][st[res.b]] || (nodes[res.a][st[res.a]] != res.c && nodes[res.b][st[res.b]] != res.c)) ^ valori1.cpp:58:81: error: request for member 'a' in 'res', which is of non-class type 'const int' if(nodes[res.a][st[res.a]] == nodes[res.b][st[res.b]] || (nodes[res.a][st[res.a]] != res.c && nodes[res.b][st[res.b]] != res.c)) ^ valori1.cpp:58:91: error: request for member 'a' in 'res', which is of non-class type 'const int' if(nodes[res.a][st[res.a]] == nodes[res.b][st[res.b]] || (nodes[res.a][st[res.a]] != res.c && nodes[res.b][st[res.b]] != res.c)) ^ valori1.cpp:58:102: error: request for member 'c' in 'res', which is of non-class type 'const int' if(nodes[res.a][st[res.a]] == nodes[res.b][st[res.b]] || (nodes[res.a][st[res.a]] != res.c && nodes[res.b][st[res.b]] != res.c)) ^ valori1.cpp:58:117: error: request for member 'b' in 'res', which is of non-class type 'const int' if(nodes[res.a][st[res.a]] == nodes[res.b][st[res.b]] || (nodes[res.a][st[res.a]] != res.c && nodes[res.b][st[res.b]] != res.c)) ^ valori1.cpp:58:127: error: request for member 'b' in 'res', which is of non-class type 'const int' if(nodes[res.a][st[res.a]] == nodes[res.b][st[res.b]] || (nodes[res.a][st[res.a]] != res.c && nodes[res.b][st[res.b]] != res.c)) ^ valori1.cpp:58:138: error: request for member 'c' in 'res', which is of non-class type 'const int' if(nodes[res.a][st[res.a]] == nodes[res.b][st[res.b]] || (nodes[res.a][st[res.a]] != res.c && nodes[res.b][st[res.b]] != res.c)) ^ valori1.cpp: In function 'void bt()': valori1.cpp:77:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if(st[j] == nodes[j].size()) ^ valori1.cpp: In function 'int main()': valori1.cpp:119:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int j = 0; j < nodes[res.a].size(); ++j) { ^
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ă.