#3697
drumuri2
Fie G un graf orientat cu N
noduri și M
arce. Spunem că nodul Y
este accesibil din nodul X
dacă se poate ajunge de la X
la Y
mergând pe arce în sensul corespunzător al acestora. Spunem că nodul X
este “popular” dacă pentru fiecare nod Y
al grafului G se îndeplinește cel puțin una din condițiile:
1. X
este accesibil din Y
;
2. Y
este accesibil din X
.
Dându-se cele două numere N
si M
cât si arcele grafului, să se afle care sunt nodurile populare din graf.
ONI 2013, Clasele XI-XII
Problema | drumuri2 | Operații I/O |
drumuri.in /drumuri.out
|
---|---|---|---|
Limita timp | 0.3 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #44041358 | Utilizator | |
Fișier | drumuri2.cpp | Dimensiune | 1.68 KB |
Data încărcării | 12 Iunie 2023, 13:15 | Scor / rezultat | Eroare de compilare |
drumuri2.cpp: In function 'int main()': drumuri2.cpp:2:31: error: 'stdin' was not declared in this scope freopen("drumuri.in", "rt", stdin); ^ drumuri2.cpp:2:36: error: 'freopen' was not declared in this scope freopen("drumuri.in", "rt", stdin); ^ drumuri2.cpp:3:32: error: 'stdout' was not declared in this scope freopen("drumuri.out", "wt", stdout); ^ drumuri2.cpp:5:18: error: 'n' was not declared in this scope scanf("%d%d", &n, &m); ^ drumuri2.cpp:5:22: error: 'm' was not declared in this scope scanf("%d%d", &n, &m); ^ drumuri2.cpp:5:23: error: 'scanf' was not declared in this scope scanf("%d%d", &n, &m); ^ drumuri2.cpp:12:5: error: 'v' was not declared in this scope v[x].push_back(y); ^ drumuri2.cpp:13:5: error: 'w' was not declared in this scope w[y].push_back(x); ^ drumuri2.cpp:15:5: error: 'muchii' was not declared in this scope muchii.push_back(make_pair(x, y)); ^ drumuri2.cpp:15:36: error: 'make_pair' was not declared in this scope muchii.push_back(make_pair(x, y)); ^ drumuri2.cpp:19:9: error: 'fst' was not declared in this scope if (fst[i] == false) { ^ drumuri2.cpp:20:12: error: 'df1' was not declared in this scope df1(i); ^ drumuri2.cpp:25:9: error: 'fst' was not declared in this scope if (fst[postordine[i]] == true) { ^ drumuri2.cpp:25:13: error: 'postordine' was not declared in this scope if (fst[postordine[i]] == true) { ^ drumuri2.cpp:26:7: error: 'nr_tare' was not declared in this scope nr_tare++; ^ drumuri2.cpp:28:7: error: 'comps' was not declared in this scope comps.push_back(vector<int>()); ^ drumuri2.cpp:28:23: error: 'vector' was not declared in this scope comps.push_back(vector<int>()); ^ drumuri2.cpp:28:30: error: expected primary-expression before 'int' comps.push_back(vector<int>()); ^ drumuri2.cpp:30:24: error: 'df2' was not declared in this scope df2(postordine[i]); ^ drumuri2.cpp:39:9: error: 'which' was not declared in this scope if (which[muchii[i].first] != which[muchii[i].second]) { ^ drumuri2.cpp:39:15: error: 'muchii' was not declared in this scope if (which[muchii[i].first] != which[muchii[i].second]) { ^ drumuri2.cpp:40:7: error: 'vec' was not declared in this scope vec[which[muchii[i].first]].push_back(which[muchii[i].second]); ^ drumuri2.cpp:42:7: error: 'rev_vec' was not declared in this scope rev_vec[which[muchii[i].second]].push_back(which[muchii[i].first]); ^ drumuri2.cpp:46:24: error: 'nr_tare' was not declared in this scope for (int i = 1; i <= nr_tare; i++) { ^ drumuri2.cpp:47:9: error: 'fst' was not declared in this scope if (fst[i] == false) { ^ drumuri2.cpp:48:15: error: 'doSort' was not declared in this scope doSort(i); ^ drumuri2.cpp:52:11: error: 'top_sort' was not declared in this scope calcAll(top_sort, rev_vec, 0); ^ drumuri2.cpp:52:21: error: 'rev_vec' was not declared in this scope calcAll(top_sort, rev_vec, 0); ^ drumuri2.cpp:52:31: error: 'calcAll' was not declared in this scope calcAll(top_sort, rev_vec, 0); ^ drumuri2.cpp:54:43: error: 'reverse' was not declared in this scope reverse(top_sort.begin(), top_sort.end()); ^ drumuri2.cpp:60:21: error: 'vec' was not declared in this scope calcAll(top_sort, vec, 1); ^ drumuri2.cpp:62:24: error: 'nr_tare' was not declared in this scope for (int i = 1; i <= nr_tare; i++) { ^ drumuri2.cpp:67:24: error: 'nr_tare' was not declared in this scope for (int i = 1; i <= nr_tare; i++) { ^ drumuri2.cpp:68:9: error: 'cnt' was not declared in this scope if (cnt[0][i] + cnt[1][i] == nr_tare + 1) { ^ drumuri2.cpp:69:32: error: 'comps' was not declared in this scope for (int j = 0; j < (int)comps[i - 1].size(); j++) { ^ drumuri2.cpp:71:9: error: 'good' was not declared in this scope good[comps[i - 1][j]] = true; ^ drumuri2.cpp:76:24: error: 'printf' was not declared in this scope printf("%d\n", nr_rez); ^ drumuri2.cpp:78:9: error: 'good' was not declared in this scope if (good[i] == true) { ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema drumuri2 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ă.