#343
Soarece1
Se dă o tablă dreptunghiulară formată din n
linii și m
coloane, definind n*m
zone, unele dintre ele fiind libere, altele conținând obstacole. Într-o zonă precizată se află un șoarece care se poate deplasa pe tablă trecând din zona curentă în zona învecinată cu aceasta pe linie sau pe coloană. Scopul sau este să ajungă la o bucată de brânză aflată într-o zonă de asemenea precizată, fără a părăsi tabla, fără a trece prin zone care conțin obstacole și fără a trece de două ori prin aceeași zonă.
Determinați o modalitate prin care șoarecele poate să ajungă la bucata de brânză.
Problema | Soarece1 | Operații I/O |
soarece1.in /soarece1.out
|
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #43627516 | Utilizator | |
Fișier | soarece1.cpp | Dimensiune | 3.07 KB |
Data încărcării | 07 Mai 2023, 14:57 | Scor / rezultat | Eroare de compilare |
soarece1.cpp:61:2: error: stray '#' in program }#include <bits/stdc++.h> ^ soarece1.cpp: In function 'void afisare()': soarece1.cpp:19:31: error: reference to 'cout' is ambiguous if(a[i][j] == -1) cout << 0 << " "; ^ soarece1.cpp:4:10: note: candidates are: std::ofstream cout ofstream cout("soarece1.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from soarece1.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ soarece1.cpp:20:18: error: reference to 'cout' is ambiguous else cout << a[i][j] << " "; ^ soarece1.cpp:4:10: note: candidates are: std::ofstream cout ofstream cout("soarece1.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from soarece1.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ soarece1.cpp:21:9: error: reference to 'cout' is ambiguous cout << '\n'; ^ soarece1.cpp:4:10: note: candidates are: std::ofstream cout ofstream cout("soarece1.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from soarece1.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ soarece1.cpp: In function 'int main()': soarece1.cpp:41:5: error: reference to 'cin' is ambiguous cin >> n >> m; ^ soarece1.cpp:3:10: note: candidates are: std::ifstream cin ifstream cin("soarece1.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from soarece1.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ soarece1.cpp:45:13: error: reference to 'cin' is ambiguous cin >> s; ^ soarece1.cpp:3:10: note: candidates are: std::ifstream cin ifstream cin("soarece1.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from soarece1.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ soarece1.cpp:57:17: error: reference to 'cout' is ambiguous cout << 0 << " "; ^ soarece1.cpp:4:10: note: candidates are: std::ofstream cout ofstream cout("soarece1.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from soarece1.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ soarece1.cpp:58:13: error: reference to 'cout' is ambiguous cout << '\n'; ^ soarece1.cpp:4:10: note: candidates are: std::ofstream cout ofstream cout("soarece1.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from soarece1.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ soarece1.cpp: At global scope: soarece1.cpp:61:3: error: 'include' does not name a type }#include <bits/stdc++.h> ^ soarece1.cpp:63:13: error: redefinition of 'std::ifstream cin' ifstream cin("soarece1.in"); ^ soarece1.cpp:3:10: error: 'std::ifstream cin' previously declared here ifstream cin("soarece1.in"); ^ soarece1.cpp:64:14: error: redefinition of 'std::ofstream cout' ofstream cout("soarece1.out"); ^ soarece1.cpp:4:10: error: 'std::ofstream cout' previously declared here ofstream cout("soarece1.out"); ^ soarece1.cpp:65:5: error: redefinition of 'int n' int n , m , is , js , ib , jb , a[11][11] , gata; ^ soarece1.cpp:5:5: error: 'int n' previously declared here int n , m , is , js , ib , jb , a[11][11] , gata; ^ soarece1.cpp:65:9: error: redefinition of 'int m' int n , m , is , js , ib , jb , a[11][11] , gata; ^ soarece1.cpp:5:9: error: 'int m' previously declared here int n , m , is , js , ib , jb , a[11][11] , gata; ^ soarece1.cpp:65:13: error: redefinition of 'int is' int n , m , is , js , ib , jb , a[11][11] , gata; ^ soarece1.cpp:5:13: error: 'int is' previously declared here int n , m , is , js , ib , jb , a[11][11] , gata; ^ soarece1.cpp:65:18: error: redefinition of 'int js' int n , m , is , js , ib , jb , a[11][11] , gata; ^ soarece1.cpp:5:18: error: 'int js' previously declared here int n , m , is , js , ib , jb , a[11][11] , gata; ^ soarece1.cpp:65:23: error: redefinition of 'int ib' int n , m , is , js , ib , jb , a[11][11] , gata; ^ soarece1.cpp:5:23: error: 'int ib' previously declared here int n , m , is , js , ib , jb , a[11][11] , gata; ^ soarece1.cpp:65:28: error: redefinition of 'int jb' int n , m , is , js , ib , jb , a[11][11] , gata; ^ soarece1.cpp:5:28: error: 'int jb' previously declared here int n , m , is , js , ib , jb , a[11][11] , gata; ^ soarece1.cpp:65:41: error: redefinition of 'int a [11][11]' int n , m , is , js , ib , jb , a[11][11] , gata; ^ soarece1.cpp:5:33: error: 'int a [11][11]' previously declared here int n , m , is , js , ib , jb , a[11][11] , gata; ^ soarece1.cpp:65:45: error: redefinition of 'int gata' int n , m , is , js , ib , jb , a[11][11] , gata; ^ soarece1.cpp:5:45: error: 'int gata' previously declared here int n , m , is , js , ib , jb , a[11][11] , gata; ^ soarece1.cpp:66:6: error: redefinition of 'char s' char s; ^ soarece1.cpp:6:6: error: 'char s' previously declared here char s; ^ soarece1.cpp:67:14: error: redefinition of 'const int di []' const int di[] = {0 , 0 , 1 , -1}; ^ soarece1.cpp:7:11: error: 'const int di [4]' previously defined here const int di[] = {0 , 0 , 1 , -1}; ^ soarece1.cpp:68:14: error: redefinition of 'const int dj []' const int dj[] = {1 , -1 , 0 , 0}; ^ soarece1.cpp:8:11: error: 'const int dj [4]' previously defined here const int dj[] = {1 , -1 , 0 , 0}; ^ soarece1.cpp: In function 'int inside(int, int)': soarece1.cpp:69:5: error: redefinition of 'int inside(int, int)' int inside(int i , int j) ^ soarece1.cpp:9:5: error: 'int inside(int, int)' previously defined here int inside(int i , int j) ^ soarece1.cpp: In function 'void afisare()': soarece1.cpp:73:6: error: redefinition of 'void afisare()' void afisare() ^ soarece1.cpp:13:6: error: 'void afisare()' previously defined here void afisare() ^ soarece1.cpp:79:31: error: reference to 'cout' is ambiguous if(a[i][j] == -1) cout << 0 << " "; ^ soarece1.cpp:4:10: note: candidates are: std::ofstream cout ofstream cout("soarece1.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from soarece1.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ soarece1.cpp:80:18: error: reference to 'cout' is ambiguous else cout << a[i][j] << " "; ^ soarece1.cpp:4:10: note: candidates are: std::ofstream cout ofstream cout("soarece1.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from soarece1.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ soarece1.cpp:81:9: error: reference to 'cout' is ambiguous cout << '\n'; ^ soarece1.cpp:4:10: note: candidates are: std::ofstream cout ofstream cout("soarece1.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from soarece1.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ soarece1.cpp: In function 'void back(int, int, int)': soarece1.cpp:84:6: error: redefinition of 'void back(int, int, int)' void back(int i , int j , int pas) ^ soarece1.cpp:24:6: error: 'void back(int, int, int)' previously defined here void back(int i , int j , int pas) ^ soarece1.cpp: In function 'int main()': soarece1.cpp:99:5: error: redefinition of 'int main()' int main() ^ soarece1.cpp:39:5: error: 'int main()' previously defined here int main() ^ soarece1.cpp:101:5: error: reference to 'cin' is ambiguous cin >> n >> m; ^ soarece1.cpp:3:10: note: candidates are: std::ifstream cin ifstream cin("soarece1.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from soarece1.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ soarece1.cpp:105:13: error: reference to 'cin' is ambiguous cin >> s; ^ soarece1.cpp:3:10: note: candidates are: std::ifstream cin ifstream cin("soarece1.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from soarece1.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ soarece1.cpp:117:17: error: reference to 'cout' is ambiguous cout << 0 << " "; ^ soarece1.cpp:4:10: note: candidates are: std::ofstream cout ofstream cout("soarece1.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from soarece1.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ soarece1.cpp:118:13: error: reference to 'cout' is ambiguous cout << '\n'; ^ soarece1.cpp:4:10: note: candidates are: std::ofstream cout ofstream cout("soarece1.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from soarece1.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Soarece1 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ă.