#2436
castel1
Arheologii au descoperit pe un platou muntos greu accesibil ruinele unui castel medieval, pe care l-au fotografiat din elicopter, obţinând harta digitizată a acestuia. Harta este memorată sub forma unui tablou bidimensional H
, compus din N x N
pătrate cu latura egală cu unitatea, având ca elemente numere naturale între 0
și 15
, care codifică forma pereţilor fiecărui pătrat unitar. Dacă scriem numărul natural H[i][j]
în baza 2
, folosind exact 4
cifre binare, fiecare bit dă informații despre unul dintre pereții posibil de construit pe fiecare latură a pătratului unitar din poziția (i,j)
, astfel:
0
are valoarea 1
, atunci există perete pe latura vestică (latura din stânga);1
are valoarea 1
, atunci există perete pe latura sudică (latura de jos);2
are valoarea 1
, atunci există perete pe latura estică (latura din dreapta);3
are valoarea 1
, atunci există perete pe latura nordică (latura de sus);0
indică lipsa peretelui corespunzător acestuia;Pentru un număr scris în baza 2
, numerotarea cifrelor începe cu poziția 0
, de la dreapta la stânga.
Castelul este interesant deoarece, pentru realizarea unei mai bune apărări, camerele ce-l compun sunt construite fie independent, fie una în interiorul alteia. Orice camera este construită la o distanţă de cel puţin o unitate faţă de zidul ce împrejmuieşte castelul sau faţă de pereţii altor camere.
Folosind harta, arheologii doresc să afle informaţii privind numărul camerelor şi camera de arie maximă. Prin arie a unei camere se înţelege numărul pătratelor unitate cuprinse în interiorul pereților aceasteia, fără a socoti ariile camerelor construite în interiorul ei.
Cunoscând codificarea hărţii castelului, să se determine:
1. numărul total al camerelor din castel
2. aria maximă a unei camere
3. coordonatele colţurilor din stânga-sus, respectiv dreapta-jos a camerei cu aria maximă. Dacă există mai multe camere având aceeaşi arie maximă, atunci se vor afişa coordonatele camerei având colţul din stânga-sus (lin1, col1)
cu lin1
minimă, iar la linii egale pe aceea cu col1
minimă.
Problema | castel1 | Operații I/O |
castel1.in /castel1.out
|
---|---|---|---|
Limita timp | 0.2 secunde | Limita memorie |
Total: 64 MB
/
Stivă 32 MB
|
Id soluție | #49231654 | Utilizator | |
Fișier | castel1.cpp | Dimensiune | 8.13 KB |
Data încărcării | 21 Februarie 2024, 11:57 | Scor / rezultat | Eroare de compilare |
castel1.cpp:210:2: error: stray '#' in program }#include <iostream> ^ castel1.cpp:210:3: error: 'include' does not name a type }#include <iostream> ^ castel1.cpp:223:14: error: redefinition of 'const string NAME' const string NAME = "castel1"; ^ castel1.cpp:14:14: error: 'const string NAME' previously declared here const string NAME = "data"; ^ castel1.cpp:226:7: error: redefinition of 'short int n' short n; ^ castel1.cpp:17:7: error: 'short int n' previously declared here short n; ^ castel1.cpp:227:22: error: redefinition of 'short int castel [101][101]' short castel[101][101]; ^ castel1.cpp:18:7: error: 'short int castel [101][101]' previously declared here short castel[101][101]; ^ castel1.cpp:229:15: error: redefinition of 'constexpr const int STANGA' constexpr int STANGA = 0; ^ castel1.cpp:20:15: error: 'constexpr const int STANGA' previously defined here constexpr int STANGA = 0; ^ castel1.cpp:230:15: error: redefinition of 'constexpr const int JOS' constexpr int JOS = 1; ^ castel1.cpp:21:15: error: 'constexpr const int JOS' previously defined here constexpr int JOS = 1; ^ castel1.cpp:231:15: error: redefinition of 'constexpr const int DREAPTA' constexpr int DREAPTA = 2; ^ castel1.cpp:22:15: error: 'constexpr const int DREAPTA' previously defined here constexpr int DREAPTA = 2; ^ castel1.cpp:232:15: error: redefinition of 'constexpr const int SUS' constexpr int SUS = 3; ^ castel1.cpp:23:15: error: 'constexpr const int SUS' previously defined here constexpr int SUS = 3; ^ castel1.cpp:234:18: error: redefinition of 'constexpr const int di []' constexpr int di[] = { 0, 1, 0, -1 }; ^ castel1.cpp:25:15: error: 'constexpr const int di [4]' previously defined here constexpr int di[] = { 0, 1, 0, -1 }; ^ castel1.cpp:235:18: error: redefinition of 'constexpr const int dj []' constexpr int dj[] = { -1, 0, 1, 0 }; ^ castel1.cpp:26:15: error: 'constexpr const int dj [4]' previously defined here constexpr int dj[] = { -1, 0, 1, 0 }; ^ castel1.cpp:237:14: error: redefinition of 'std::ifstream fin' ifstream fin(NAME + ".in"); ^ castel1.cpp:28:10: error: 'std::ifstream fin' previously declared here ifstream fin(NAME + ".in"); ^ castel1.cpp:238:15: error: redefinition of 'std::ofstream fout' ofstream fout(NAME + ".out"); ^ castel1.cpp:29:10: error: 'std::ofstream fout' previously declared here ofstream fout(NAME + ".out"); ^ castel1.cpp:240:22: error: redefinition of 'std::array<std::bitset<16u>, 4u> directii' array<bitset<16>, 4> directii; ^ castel1.cpp:31:22: error: 'std::array<std::bitset<16u>, 4u> directii' previously defined here array<bitset<16>, 4> directii; ^ castel1.cpp:241:25: error: redefinition of 'std::array<std::bitset<101u>, 101u> vizitat' array<bitset<101>, 101> vizitat; ^ castel1.cpp:32:25: error: 'std::array<std::bitset<101u>, 101u> vizitat' previously defined here array<bitset<101>, 101> vizitat; ^ castel1.cpp:242:5: error: redefinition of 'int lin1Curent' int lin1Curent, col1Curent, lin2Curent, col2Curent; ^ castel1.cpp:33:5: error: 'int lin1Curent' previously declared here int lin1Curent, col1Curent, lin2Curent, col2Curent; ^ castel1.cpp:242:17: error: redefinition of 'int col1Curent' int lin1Curent, col1Curent, lin2Curent, col2Curent; ^ castel1.cpp:33:17: error: 'int col1Curent' previously declared here int lin1Curent, col1Curent, lin2Curent, col2Curent; ^ castel1.cpp:242:29: error: redefinition of 'int lin2Curent' int lin1Curent, col1Curent, lin2Curent, col2Curent; ^ castel1.cpp:33:29: error: 'int lin2Curent' previously declared here int lin1Curent, col1Curent, lin2Curent, col2Curent; ^ castel1.cpp:242:41: error: redefinition of 'int col2Curent' int lin1Curent, col1Curent, lin2Curent, col2Curent; ^ castel1.cpp:33:41: error: 'int col2Curent' previously declared here int lin1Curent, col1Curent, lin2Curent, col2Curent; ^ castel1.cpp:244:31: error: redefinition of 'short int pereteDeVerificatVecin [4]' short pereteDeVerificatVecin[4]; ^ castel1.cpp:35:7: error: 'short int pereteDeVerificatVecin [4]' previously declared here short pereteDeVerificatVecin[4]; ^ castel1.cpp: In function 'void initPereteDeVerificatVecin()': castel1.cpp:246:6: error: redefinition of 'void initPereteDeVerificatVecin()' void initPereteDeVerificatVecin() ^ castel1.cpp:37:6: error: 'void initPereteDeVerificatVecin()' previously defined here void initPereteDeVerificatVecin() ^ castel1.cpp: In function 'void initBitseturi()': castel1.cpp:254:7: error: redefinition of 'void initBitseturi()' void initBitseturi() ^ castel1.cpp:45:7: error: 'void initBitseturi()' previously defined here void initBitseturi() ^ castel1.cpp: In function 'bool contine(int, int)': castel1.cpp:271:6: error: redefinition of 'bool contine(int, int)' bool contine(int i, int j) ^ castel1.cpp:62:6: error: 'bool contine(int, int)' previously defined here bool contine(int i, int j) ^ castel1.cpp: In function 'bool areCameraPeretiLaMargini(int, int)': castel1.cpp:276:6: error: redefinition of 'bool areCameraPeretiLaMargini(int, int)' bool areCameraPeretiLaMargini(int i, int j) ^ castel1.cpp:67:6: error: 'bool areCameraPeretiLaMargini(int, int)' previously defined here bool areCameraPeretiLaMargini(int i, int j) ^ castel1.cpp: At global scope: castel1.cpp:289:5: error: redefinition of 'int arieSpatiuCurent' int arieSpatiuCurent; ^ castel1.cpp:80:5: error: 'int arieSpatiuCurent' previously declared here int arieSpatiuCurent; ^ castel1.cpp: In function 'bool Fill(int, int)': castel1.cpp:290:6: error: redefinition of 'bool Fill(int, int)' bool Fill(int startI, int startJ) ^ castel1.cpp:81:6: error: 'bool Fill(int, int)' previously defined here bool Fill(int startI, int startJ) ^ castel1.cpp: In function 'void cerinta1()': castel1.cpp:342:6: error: redefinition of 'void cerinta1()' void cerinta1() ^ castel1.cpp:133:6: error: 'void cerinta1()' previously defined here void cerinta1() ^ castel1.cpp: In function 'void cerinta2si3(bool)': castel1.cpp:357:6: error: redefinition of 'void cerinta2si3(bool)' void cerinta2si3(bool doi) ^ castel1.cpp:148:6: error: 'void cerinta2si3(bool)' previously defined here void cerinta2si3(bool doi) ^ castel1.cpp: In function 'int main()': castel1.cpp:394:5: error: redefinition of 'int main()' int main() { ^ castel1.cpp:185:5: error: 'int main()' previously defined here int main() { ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema castel1 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ă.