#4661
dominoes
Se dă o matrice cu 2
linii si n
coloane care are k
celule ocupate. Se dau q
interogări de forma (x1, y1, x2, y2)
, cu următoarea semnificație: dacă se ocupă două celule libere distincte ale matricii inițiale, (x1, y1)
și (x2, y2)
, se poate pava complet matricea cu piese de domino de dimensiuni 2 x 1
și 1 x 2
? După efectuarea unei interogări celulele ocupate asociate acesteia vor deveni din nou libere (modificările aduse matricei nu persistă între interogări). Să se determine, pentru fiecare interogare, dacă este posibil ca matricea să fie pavată complet cu piese de domino de dimensiuni 2 x 1
și 1 x 2
.
Problema | dominoes | Operații I/O |
![]() dominoes.in /dominoes.out
|
---|---|---|---|
Limita timp | 0.5 secunde | Limita memorie |
Total: 256 MB
/
Stivă 32 MB
|
Id soluție | #58569246 | Utilizator | |
Fișier | dominoes.cpp | Dimensiune | 4.56 KB |
Data încărcării | 20 Iunie 2025, 22:53 | Scor / rezultat | Eroare de compilare |
dominoes.cpp:7:1: error: 'ifstream' does not name a type ifstream fin("dominoes.in"); ^ dominoes.cpp:8:1: error: 'ofstream' does not name a type ofstream fout("dominoes.out"); ^ dominoes.cpp:28:37: error: 'vector' does not name a type int get_prefix_sum(int index, const vector<int>& sums) { ^ dominoes.cpp:28:37: error: ISO C++ forbids declaration of 'parameter' with no type [-fpermissive] dominoes.cpp:28:43: error: expected ',' or '...' before '<' token int get_prefix_sum(int index, const vector<int>& sums) { ^ dominoes.cpp: In function 'int get_prefix_sum(int, int)': dominoes.cpp:32:12: error: 'sums' was not declared in this scope return sums[index]; ^ dominoes.cpp: In function 'int main()': dominoes.cpp:37:5: error: 'ios_base' has not been declared ios_base::sync_with_stdio(false); ^ dominoes.cpp:38:5: error: 'fin' was not declared in this scope fin.tie(NULL); ^ dominoes.cpp:44:5: error: 'vector' was not declared in this scope vector<Point> initial_blocked(k); ^ dominoes.cpp:44:5: note: suggested alternative: In file included from /usr/include/c++/4.8/vector:64:0, from dominoes.cpp:2: /usr/include/c++/4.8/bits/stl_vector.h:210:11: note: 'std::vector' class vector : protected _Vector_base<_Tp, _Alloc> ^ dominoes.cpp:44:17: error: expected primary-expression before '>' token vector<Point> initial_blocked(k); ^ dominoes.cpp:44:36: error: 'initial_blocked' was not declared in this scope vector<Point> initial_blocked(k); ^ dominoes.cpp:50:56: error: 'sort' was not declared in this scope sort(initial_blocked.begin(), initial_blocked.end()); ^ dominoes.cpp:50:56: note: suggested alternative: In file included from /usr/include/c++/4.8/algorithm:62:0, from dominoes.cpp:3: /usr/include/c++/4.8/bits/stl_algo.h:5483:5: note: 'std::sort' sort(_RandomAccessIterator __first, _RandomAccessIterator __last, ^ dominoes.cpp:52:12: error: expected primary-expression before 'int' vector<int> v_values(k); ^ dominoes.cpp:52:12: error: expected ';' before 'int' dominoes.cpp:54:9: error: 'v_values' was not declared in this scope v_values[i] = get_val(initial_blocked[i].r, initial_blocked[i].c); ^ dominoes.cpp:59:12: error: expected primary-expression before 'int' vector<int> odd_mismatch_prefix_sum; ^ dominoes.cpp:59:12: error: expected ';' before 'int' dominoes.cpp:61:9: error: 'odd_mismatch_prefix_sum' was not declared in this scope odd_mismatch_prefix_sum.resize((k / 2), 0); ^ dominoes.cpp:64:17: error: 'v_values' was not declared in this scope if (v_values[i] == v_values[i + 1]) { ^ dominoes.cpp:78:24: error: 'swap' was not declared in this scope swap(q1, q2); ^ dominoes.cpp:78:24: note: suggested alternatives: In file included from /usr/include/c++/4.8/bits/stl_algo.h:66:0, from /usr/include/c++/4.8/algorithm:62, from dominoes.cpp:3: /usr/include/c++/4.8/functional:2573:5: note: 'std::swap' swap(function<_Res(_Args...)>& __x, function<_Res(_Args...)>& __y) ^ In file included from /usr/include/c++/4.8/exception:152:0, from /usr/include/c++/4.8/ios:39, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from dominoes.cpp:1: /usr/include/c++/4.8/bits/exception_ptr.h:160:5: note: 'std::__exception_ptr::swap' swap(exception_ptr& __lhs, exception_ptr& __rhs) ^ dominoes.cpp:82:80: error: 'lower_bound' was not declared in this scope int p1 = lower_bound(initial_blocked.begin(), initial_blocked.end(), q1) - initial_blocked.begin(); ^ dominoes.cpp:82:80: note: suggested alternative: In file included from /usr/include/c++/4.8/algorithm:62:0, from dominoes.cpp:3: /usr/include/c++/4.8/bits/stl_algo.h:2425:5: note: 'std::lower_bound' lower_bound(_ForwardIterator __first, _ForwardIterator __last, ^ dominoes.cpp:89:13: error: 'fout' was not declared in this scope fout << 0 << "\n"; ^ dominoes.cpp:100:35: error: 'v_values' was not declared in this scope if (p1 < k && v_q1 == v_values[p1]) total_mismatches++; ^ dominoes.cpp:102:27: error: 'v_values' was not declared in this scope if (p1 > 0 && v_values[p1 - 1] == v_q1) total_mismatches++; ^ dominoes.cpp:107:28: error: 'v_values' was not declared in this scope if (p2 > 0 && v_values[p2 - 1] == v_q2) total_mismatches++; ^ dominoes.cpp:109:28: error: 'v_values' was not declared in this scope if (p2 > 0 && v_values[p2 - 1] == v_q2) total_mismatches++; ^ dominoes.cpp:121:65: error: 'odd_mismatch_prefix_sum' was not declared in this scope total_mismatches += get_prefix_sum(end_sum_idx, odd_mismatch_prefix_sum) - ^ dominoes.cpp:131:13: error: 'fout' was not declared in this scope fout << 1 << "\n"; ^ dominoes.cpp:133:13: error: 'fout' was not declared in this scope fout << 0 << "\n"; ^ dominoes.cpp:138:5: error: 'fout' was not declared in this scope fout.close(); ^ dominoes.cpp: In function 'int get_prefix_sum(int, int)': dominoes.cpp:33:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema dominoes 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ă.