#2232
retea1
Pentru a testa o nouă topologie s-a construit o reţea de calculatoare în care fiecare calculator transmite informaţia unidirecţional către un singur calculator din reţea. Numim conexiune o pereche ordonată de calculatoare, nu neapărat distincte, în care primul este cel care trimite informaţia iar al doilea este cel care o recepţioneaza direct. Fiind dată o astfel de reţea şi conexiunile existente între calculatoarele care o alcătuiesc, să se determine submulţimea cu număr maxim de calculatoare-feed-back. Un calculator-feed-back are proprietatea că informația ce pleacă de la acesta ajunge, prin intermediul conexiunilor succesive, înapoi la calculatorul de la care a plecat.
Scrieţi un program care, pentru o reţea cu n
calculatoare numerotate de la 1
la n
şi conexiuni precizate, determină submulţimea cu număr maxim de calculatoare-feed-back.
Olimpiada Municipala de Informatica, Iasi, 2008
Problema | retea1 | Operații I/O |
retea1.in /retea1.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #54375466 | Utilizator | |
Fișier | retea1.cpp | Dimensiune | 1.41 KB |
Data încărcării | 26 Noiembrie 2024, 23:25 | Scor / rezultat | Eroare de compilare |
retea1.cpp:3:14: warning: missing terminating " character [enabled by default] ifstream cin("retea1.in); ^ retea1.cpp:3:1: error: missing terminating " character ifstream cin("retea1.in); ^ retea1.cpp:4:15: warning: missing terminating " character [enabled by default] ofstream cout("retea1.out); ^ retea1.cpp:4:1: error: missing terminating " character ofstream cout("retea1.out); ^ retea1.cpp:5:7: error: 'x' has not been declared int n,x,y,a[1001][1001],p[1001],s[1001],nrc,nrv[1001]; ^ retea1.cpp:5:9: error: 'y' has not been declared int n,x,y,a[1001][1001],p[1001],s[1001],nrc,nrv[1001]; ^ retea1.cpp:5:11: error: 'a' has not been declared int n,x,y,a[1001][1001],p[1001],s[1001],nrc,nrv[1001]; ^ retea1.cpp:5:25: error: 'p' has not been declared int n,x,y,a[1001][1001],p[1001],s[1001],nrc,nrv[1001]; ^ retea1.cpp:5:33: error: 's' has not been declared int n,x,y,a[1001][1001],p[1001],s[1001],nrc,nrv[1001]; ^ retea1.cpp:5:41: error: 'nrc' has not been declared int n,x,y,a[1001][1001],p[1001],s[1001],nrc,nrv[1001]; ^ retea1.cpp:5:45: error: 'nrv' has not been declared int n,x,y,a[1001][1001],p[1001],s[1001],nrc,nrv[1001]; ^ retea1.cpp:5:54: error: expected ')' before ';' token int n,x,y,a[1001][1001],p[1001],s[1001],nrc,nrv[1001]; ^ retea1.cpp:5:54: error: expected ')' before ';' token retea1.cpp: In function 'void dfs1(int)': retea1.cpp:8:5: error: 's' was not declared in this scope s[x]=nrc; ^ retea1.cpp:8:10: error: 'nrc' was not declared in this scope s[x]=nrc; ^ retea1.cpp:9:20: error: 'n' was not declared in this scope for(int i=1;i<=n;i++) ^ retea1.cpp:11:12: error: 'a' was not declared in this scope if(a[x][i] && !s[i]) ^ retea1.cpp: In function 'void dfs2(int)': retea1.cpp:19:5: error: 'p' was not declared in this scope p[x]=nrc; ^ retea1.cpp:19:10: error: 'nrc' was not declared in this scope p[x]=nrc; ^ retea1.cpp:20:20: error: 'n' was not declared in this scope for(int i=1;i<=n;i++) ^ retea1.cpp:22:12: error: 'a' was not declared in this scope if(a[i][x] && !p[i]) ^ retea1.cpp: In function 'int main()': retea1.cpp:30:5: error: reference to 'cin' is ambiguous cin>>n; ^ retea1.cpp:3:10: note: candidates are: std::ifstream cin(std::ofstream (*)(int, int, int, int (*)[1001], int*, int*, int, int*)) ifstream cin("retea1.in); ^ In file included from retea1.cpp:1:0: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ retea1.cpp:30:10: error: 'n' was not declared in this scope cin>>n; ^ retea1.cpp:35:13: error: reference to 'cin' is ambiguous cin>>a[i][j]; ^ retea1.cpp:3:10: note: candidates are: std::ifstream cin(std::ofstream (*)(int, int, int, int (*)[1001], int*, int*, int, int*)) ifstream cin("retea1.in); ^ In file included from retea1.cpp:1:0: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ retea1.cpp:35:18: error: 'a' was not declared in this scope cin>>a[i][j]; ^ retea1.cpp:40:12: error: 's' was not declared in this scope if(s[i]==0) ^ retea1.cpp:42:13: error: 'nrc' was not declared in this scope nrc++; ^ retea1.cpp:48:20: error: 's' was not declared in this scope if(s[j]!=p[j]) ^ retea1.cpp:48:26: error: 'p' was not declared in this scope if(s[j]!=p[j]) ^ retea1.cpp:58:13: error: 'nrv' was not declared in this scope nrv[s[i]]++; ^ retea1.cpp:58:17: error: 's' was not declared in this scope nrv[s[i]]++; ^ retea1.cpp:61:24: error: 'nrc' was not declared in this scope for(int i=1;i<=nrc;i++) ^ retea1.cpp:66:20: error: 's' was not declared in this scope if(s[j]==i && a[j][j]==1) ^ retea1.cpp:66:31: error: 'a' was not declared in this scope if(s[j]==i && a[j][j]==1) ^ retea1.cpp:70:19: error: 's' was not declared in this scope if(s[j]==i && nrv[i]>1) ^ retea1.cpp:70:30: error: 'nrv' was not declared in this scope if(s[j]==i && nrv[i]>1) ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema retea1 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ă.