#2968
conexidad
Fie un graf neorientat cu N
noduri și M
muchii, care NU este conex. Să i se adauge grafului un număr minim de muchii, astfel încât acesta să devină conex. Fie extra
i
numărul de muchii nou-adăugate care sunt incidente cu nodul i
, iar max_extra
cea mai mare dintre valorile extra
1
, extra
2
,… , extra
N
. Mulțimea de muchii adăugate trebuie să respecte condiția ca valoarea max_extra să fie minimă.
OJI 2019
Problema | conexidad | Operații I/O |
conexidad.in /conexidad.out
|
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 32 MB
|
Id soluție | #33167338 | Utilizator | |
Fișier | conexidad.cpp | Dimensiune | 2.54 KB |
Data încărcării | 09 Decembrie 2021, 12:45 | Scor / rezultat | Eroare de compilare |
conexidad.cpp:9:1: error: expected initializer before 'int' int n, cnt, vis[101] ^ conexidad.cpp: In function 'int getOccurences(int)': conexidad.cpp:24:17: error: 'n' was not declared in this scope for (i=1;i<=n;++i) ^ conexidad.cpp:25:13: error: 'vis' was not declared in this scope if (vis[i]==k && !ap[i]) ^ conexidad.cpp:25:27: error: 'ap' was not declared in this scope if (vis[i]==k && !ap[i]) ^ conexidad.cpp: In function 'int getExceptions()': conexidad.cpp:34:17: error: 'cnt' was not declared in this scope for (i=1;i<=cnt;++i) ^ conexidad.cpp: In function 'int getSmallestVertex(int)': conexidad.cpp:43:17: error: 'n' was not declared in this scope for (i=1;i<=n;++i) ^ conexidad.cpp:44:13: error: 'vis' was not declared in this scope if (vis[i]==k && !ap[i]) ^ conexidad.cpp:44:27: error: 'ap' was not declared in this scope if (vis[i]==k && !ap[i]) ^ conexidad.cpp:46:23: error: 'getVertex' was not declared in this scope return getVertex(k); ^ conexidad.cpp: In function 'void Mark(int)': conexidad.cpp:52:17: error: 'n' was not declared in this scope for (i=1;i<=n;++i) ^ conexidad.cpp:53:13: error: 'vis' was not declared in this scope if (vis[i]==k) ^ conexidad.cpp:54:13: error: 'ap' was not declared in this scope ap[i]=false; ^ conexidad.cpp: In function 'int getVertex(int)': conexidad.cpp:60:17: error: 'n' was not declared in this scope for (i=1;i<=n;++i) ^ conexidad.cpp:61:13: error: 'vis' was not declared in this scope if (vis[i]==k) ^ conexidad.cpp: In function 'int getSmallestException()': conexidad.cpp:68:17: error: 'cnt' was not declared in this scope for (i=1;i<=cnt;++i) ^ conexidad.cpp: In function 'int getSmallestFree()': conexidad.cpp:76:17: error: 'cnt' was not declared in this scope for (i=1;i<=cnt;++i) ^ conexidad.cpp: In function 'int main()': conexidad.cpp:85:8: error: expected initializer before '>>' token fin>>n>m; ^ conexidad.cpp:89:9: error: 'adj' was not declared in this scope adj[i][j]=adj[j][i]=true; ^ conexidad.cpp:92:17: error: 'n' was not declared in this scope for (i=1;i<=n;++i) ^ conexidad.cpp:93:14: error: 'vis' was not declared in this scope if (!vis[i]) ^ conexidad.cpp:95:15: error: 'cnt' was not declared in this scope ++cnt; ^ conexidad.cpp:96:18: error: 'DFS' was not declared in this scope DFS(i); ^ conexidad.cpp:98:5: error: 'comp' was not declared in this scope comp=getExceptions(); ^ conexidad.cpp:99:32: error: 'cnt' was not declared in this scope fout<<(comp>=3?2:1)<<'\n'<<cnt-1<<'\n'; ^ conexidad.cpp:104:9: error: 'first' was not declared in this scope first=getSmallestVertex(1); ^ conexidad.cpp:106:9: error: 'last' was not declared in this scope last=0; ^ conexidad.cpp:111:13: error: 'first' was not declared in this scope first=getSmallestException(); ^ conexidad.cpp:112:13: error: 'ap' was not declared in this scope ap[first]=0; ^ conexidad.cpp:113:13: error: 'last' was not declared in this scope last=0; ^ conexidad.cpp:120:13: error: 'first' was not declared in this scope first=getSmallestException(); ^ conexidad.cpp:121:13: error: 'ap' was not declared in this scope ap[first]=0; ^ conexidad.cpp:122:13: error: 'last' was not declared in this scope last=getSmallestException(); ^ conexidad.cpp:128:12: warning: the address of 'void free(void*)' will always evaluate as 'true' [-Waddress] while (free) ^ conexidad.cpp:130:9: error: 'curr_comp' was not declared in this scope curr_comp=getsmallestFree(); ^ conexidad.cpp:130:35: error: 'getsmallestFree' was not declared in this scope curr_comp=getsmallestFree(); ^ conexidad.cpp:131:9: error: 'curr' was not declared in this scope curr=getSmallestVertex(curr_comp); ^ conexidad.cpp:132:9: error: 'ap' was not declared in this scope ap[curr]=false; ^ conexidad.cpp:133:15: error: 'last' was not declared in this scope fout<<last<<' '<<curr<<'\n'; ^ conexidad.cpp:136:11: error: ISO C++ forbids decrementing a pointer of type 'void (*)(void*)throw ()' [-fpermissive] --free; ^ conexidad.cpp:136:11: error: lvalue required as decrement operand conexidad.cpp:138:9: error: 'last' was not declared in this scope if (last) ^ conexidad.cpp:139:15: error: 'first' was not declared in this scope fout<<first<<' '<<last; ^ conexidad.cpp: In function 'int getSmallestVertex(int)': conexidad.cpp:47:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ conexidad.cpp: In function 'int getVertex(int)': conexidad.cpp:63:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ conexidad.cpp: In function 'int getSmallestException()': conexidad.cpp:71:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ conexidad.cpp: In function 'int getSmallestFree()': conexidad.cpp:79:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema conexidad 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ă.