#1266
CautaNrInMatrice
Într-o matrice în care elementele sunt aranjate crescător pe anumite linii şi descrescător pe altele, trebuie găsită linia şi coloana pe care se află un anumit element.
Problema | CautaNrInMatrice | Operații I/O |
cautanrinmatrice.in /cautanrinmatrice.out
|
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 16 MB
/
Stivă 2 MB
|
Id soluție | #10003829 | Utilizator | |
Fișier | cautanrinmatrice.cpp | Dimensiune | 872 B |
Data încărcării | 11 Iulie 2018, 13:07 | Scor / rezultat | Eroare de compilare |
cautanrinmatrice.cpp: In function 'int main()': cautanrinmatrice.cpp:6:15: error: variable 'std::ifstream f' has initializer but incomplete type ifstream f("cautanrinmatrice.in"); ^ cautanrinmatrice.cpp:7:15: error: variable 'std::ofstream g' has initializer but incomplete type ofstream g("cautanrinmatrice.out"); ^ cautanrinmatrice.cpp:13:15: error: conflicting declaration 'main()::<anonymous struct> a [1000001]' }a[1000001]; ^ cautanrinmatrice.cpp:5:5: error: 'a' has a previous declaration as 'int a [1000001]' int a[1000001],n,m,t=1; ^ cautanrinmatrice.cpp:16:39: error: request for member 'v' in 'a[t]', which is of non-class type 'int' for(int j=1;j<=m;j++){f>>a[t].v; a[t].x=i; a[t].y=j; t++;} ^ cautanrinmatrice.cpp:16:47: error: request for member 'x' in 'a[t]', which is of non-class type 'int' for(int j=1;j<=m;j++){f>>a[t].v; a[t].x=i; a[t].y=j; t++;} ^ cautanrinmatrice.cpp:16:57: error: request for member 'y' in 'a[t]', which is of non-class type 'int' for(int j=1;j<=m;j++){f>>a[t].v; a[t].x=i; a[t].y=j; t++;} ^ cautanrinmatrice.cpp:19:42: error: request for member 'v' in 'a[i]', which is of non-class type 'int' for(int j=i+1;j<n*m;j++)if(a[i].v>a[j].v){int aux=a[i].v; a[i].v=a[j].v; a[j].v=aux;} ^ cautanrinmatrice.cpp:19:49: error: request for member 'v' in 'a[j]', which is of non-class type 'int' for(int j=i+1;j<n*m;j++)if(a[i].v>a[j].v){int aux=a[i].v; a[i].v=a[j].v; a[j].v=aux;} ^ cautanrinmatrice.cpp:19:65: error: request for member 'v' in 'a[i]', which is of non-class type 'int' for(int j=i+1;j<n*m;j++)if(a[i].v>a[j].v){int aux=a[i].v; a[i].v=a[j].v; a[j].v=aux;} ^ cautanrinmatrice.cpp:19:73: error: request for member 'v' in 'a[i]', which is of non-class type 'int' for(int j=i+1;j<n*m;j++)if(a[i].v>a[j].v){int aux=a[i].v; a[i].v=a[j].v; a[j].v=aux;} ^ cautanrinmatrice.cpp:19:80: error: request for member 'v' in 'a[j]', which is of non-class type 'int' for(int j=i+1;j<n*m;j++)if(a[i].v>a[j].v){int aux=a[i].v; a[i].v=a[j].v; a[j].v=aux;} ^ cautanrinmatrice.cpp:19:88: error: request for member 'v' in 'a[j]', which is of non-class type 'int' for(int j=i+1;j<n*m;j++)if(a[i].v>a[j].v){int aux=a[i].v; a[i].v=a[j].v; a[j].v=aux;} ^ cautanrinmatrice.cpp:21:8: error: 'p' was not declared in this scope f>>p; ^ cautanrinmatrice.cpp:22:17: error: 'j' was not declared in this scope for(int i=1;j<=p;j++) ^ cautanrinmatrice.cpp:23:9: error: 'x' was not declared in this scope {f<<x; ^ cautanrinmatrice.cpp:27:27: error: request for member 'v' in 'a[mij]', which is of non-class type 'int' if(a[mij].v==x)g<<a[mij].x<<" "<<a[mij].y<<endl; ^ cautanrinmatrice.cpp:27:42: error: request for member 'x' in 'a[mij]', which is of non-class type 'int' if(a[mij].v==x)g<<a[mij].x<<" "<<a[mij].y<<endl; ^ cautanrinmatrice.cpp:27:57: error: request for member 'y' in 'a[mij]', which is of non-class type 'int' if(a[mij].v==x)g<<a[mij].x<<" "<<a[mij].y<<endl; ^ cautanrinmatrice.cpp:28:29: error: request for member 'v' in 'a[mij]', which is of non-class type 'int' if(a[mij].v<x)dr=mij; ^ cautanrinmatrice.cpp:29:30: error: request for member 'v' in 'a[mij]', which is of non-class type 'int' if(a[mij].v>x)st=mij; ^ cautanrinmatrice.cpp:22:13: warning: unused variable 'i' [-Wunused-variable] for(int i=1;j<=p;j++) ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema CautaNrInMatrice 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ă.