#4411
Se dă un graf orientat cu n noduri și m muchii. Fiecare muchie are costul 1 (poate fi parcursă într-un minut). Doi “prieteni” (veri) pornesc din nodul S. Unul dintre ei vrea să ajungă în nodul A, iar celălalt vrea să ajungă în nodul B. Care este numărul minim de minute necesar, astfel încât să fie posibil ca amândoi să ajungă la destinațiile lor, în timpul alocat, în A, respectiv B?
OJI 2023, clasele XI-XII
| Problema | veri | Operații I/O |
veri.in/veri.out
|
|---|---|---|---|
| Limita timp | 1.6 secunde | Limita memorie |
Total: 256 MB
/
Stivă 256 MB
|
| Id soluție | #63711659 | Utilizator | |
| Fișier | veri.cpp | Dimensiune | 6.05 KB |
| Data încărcării | 16 Martie 2026, 11:54 | Scor/rezultat | Eroare de compilare |
veri.cpp:80:1: warning: "/*" within comment [-Wcomment] /* ^ veri.cpp:345:5: warning: "/*" within comment [-Wcomment] /*while(s.size()>0) ^ veri.cpp: In function 'void bfs3(int)': veri.cpp:95:5: error: 'fr1' was not declared in this scope fr1[nod]=1; ^ veri.cpp:96:5: error: 'q' was not declared in this scope q.push(nod); ^ veri.cpp:99:9: error: 'a1' was not declared in this scope a1=q.front(); ^ veri.cpp:101:19: error: 'v1' was not declared in this scope for(t=0;t<v1[a1].size();t++) ^ veri.cpp:106:18: error: 'parent' was not declared in this scope parent[v1[a1][t]]=a1; ^ veri.cpp: In function 'int main()': veri.cpp:112:5: error: 'f' was not declared in this scope f>>c>>n>>m; ^ veri.cpp:112:8: error: 'c' was not declared in this scope f>>c>>n>>m; ^ veri.cpp:112:11: error: 'n' was not declared in this scope f>>c>>n>>m; ^ veri.cpp:112:14: error: 'm' was not declared in this scope f>>c>>n>>m; ^ veri.cpp:113:8: error: 'S' was not declared in this scope f>>S>>a>>b; ^ veri.cpp:113:11: error: 'a' was not declared in this scope f>>S>>a>>b; ^ veri.cpp:113:14: error: 'b' was not declared in this scope f>>S>>a>>b; ^ veri.cpp:114:9: error: 'i' was not declared in this scope for(i=1; i<=m; i++) ^ veri.cpp:116:12: error: 'x' was not declared in this scope f>>x>>y; ^ veri.cpp:116:15: error: 'y' was not declared in this scope f>>x>>y; ^ veri.cpp:117:9: error: 'v1' was not declared in this scope v1[x].push_back(y); ^ veri.cpp:118:9: error: 'v2' was not declared in this scope v2[y].push_back(x); ^ veri.cpp:120:9: error: 'i' was not declared in this scope for(i=1; i<=n; i++) ^ veri.cpp:121:12: error: 'fr1' was not declared in this scope if(fr1[i]==0) ^ veri.cpp:122:19: error: 'dfs1' was not declared in this scope dfs1(i); ^ veri.cpp:123:5: error: 'nr' was not declared in this scope nr=0; ^ veri.cpp:124:11: error: 's' was not declared in this scope while(s.size()>0) ^ veri.cpp:126:9: error: 'x' was not declared in this scope x=s.top(); ^ veri.cpp:128:12: error: 'fr2' was not declared in this scope if(fr2[x]==0) ^ veri.cpp:131:19: error: 'dfs2' was not declared in this scope dfs2(x); ^ veri.cpp:132:16: error: 'cont' was not declared in this scope if(cont-conttrec>1) ^ veri.cpp:132:21: error: 'conttrec' was not declared in this scope if(cont-conttrec>1) ^ veri.cpp:133:21: error: 'i' was not declared in this scope for(i=conttrec+1; i<=cont; i++) ^ veri.cpp:135:21: error: 'nr1' was not declared in this scope nr1++; ^ veri.cpp:136:21: error: 'ciclic' was not declared in this scope ciclic[nr1]=ciclict[i]; ^ veri.cpp:136:33: error: 'ciclict' was not declared in this scope ciclic[nr1]=ciclict[i]; ^ veri.cpp:139:9: error: 'conttrec' was not declared in this scope conttrec=cont; ^ veri.cpp:139:18: error: 'cont' was not declared in this scope conttrec=cont; ^ veri.cpp:145:9: error: 'i' was not declared in this scope for(i=1; i<=n; i++) ^ veri.cpp:146:9: error: 'fr1' was not declared in this scope fr1[i]=0; ^ veri.cpp:147:6: error: 'bfs' was not declared in this scope bfs(S); ^ veri.cpp:149:5: error: 'i' was not declared in this scope for(i=1;i<=nr1;i++) ^ veri.cpp:149:12: error: 'nr1' was not declared in this scope for(i=1;i<=nr1;i++) ^ veri.cpp:151:10: error: 'ciclic' was not declared in this scope bfs1(ciclic[i]); ^ veri.cpp:151:19: error: 'bfs1' was not declared in this scope bfs1(ciclic[i]); ^ veri.cpp:152:5: error: 'distanta' was not declared in this scope distanta[ciclic[i]]+=dist[ciclic[i]]-1; ^ veri.cpp:152:26: error: 'dist' was not declared in this scope distanta[ciclic[i]]+=dist[ciclic[i]]-1; ^ veri.cpp:153:5: error: 'distanta1' was not declared in this scope distanta1[i]=distanta[ciclic[i]]; ^ veri.cpp:155:9: error: 'j' was not declared in this scope for(j=1;j<=n;j++) ^ veri.cpp:160:13: error: 'i' was not declared in this scope for(i=1;i<=n;i++) ^ veri.cpp:161:13: error: 'dist' was not declared in this scope dist[i]=0; ^ veri.cpp:175:9: error: 'i' was not declared in this scope for(i=1;i<=nr1;i++) ^ veri.cpp:175:16: error: 'nr1' was not declared in this scope for(i=1;i<=nr1;i++) ^ veri.cpp:177:13: error: 'j' was not declared in this scope for(j=1;j<=n;j++) ^ veri.cpp:178:13: error: 'dist' was not declared in this scope dist[j]=0; ^ veri.cpp:179:13: error: 'ciclic' was not declared in this scope bfs(ciclic[i]); ^ veri.cpp:182:1: error: 'da' was not declared in this scope da=distanta1[i]+dist[a]-1; ^ veri.cpp:182:4: error: 'distanta1' was not declared in this scope da=distanta1[i]+dist[a]-1; ^ veri.cpp:182:17: error: 'dist' was not declared in this scope da=distanta1[i]+dist[a]-1; ^ veri.cpp:183:1: error: 'db' was not declared in this scope db=distanta1[i]+dist[b]-1; ^ veri.cpp:186:4: error: 'minim' was not declared in this scope if(minim>max(da,db)) ^ veri.cpp:186:19: error: 'max' was not declared in this scope if(minim>max(da,db)) ^ veri.cpp:189:5: error: 'ret' was not declared in this scope ret=ciclic[i]; ^ veri.cpp:190:5: error: 'nrS' was not declared in this scope nrS=distanta1[i]; ^ veri.cpp:191:5: error: 'nra' was not declared in this scope nra=dist[a]-1; ^ veri.cpp:192:5: error: 'nrb' was not declared in this scope nrb=dist[b]-1; ^ veri.cpp:197:5: error: 'g' was not declared in this scope g<<minim; ^ veri.cpp:197:8: error: 'minim' was not declared in this scope g<<minim; ^ veri.cpp:200:4: error: 'endl' was not declared in this scope g<<endl; ^ veri.cpp:201:5: error: 'i' was not declared in this scope for(i=1;i<=n;i++) ^ veri.cpp:203:5: error: 'dist' was not declared in this scope dist[i]=0; ^ veri.cpp:204:5: error: 'fr1' was not declared in this scope fr1[i]=0; ^ veri.cpp:206:6: error: 'ret' was not declared in this scope bfs3(ret); ^ veri.cpp:207:1: error: 'cont' was not declared in this scope cont=0; ^ veri.cpp:208:13: error: 'nra' was not declared in this scope while(cont<=nra) ^ veri.cpp:212:9: error: 'x' was not declared in this scope x=a; ^ veri.cpp:213:9: error: 'afisa' was not declared in this scope afisa[cont]=a; ^ veri.cpp:217:5: error: 'x' was not declared in this scope x=parent[x]; ^ veri.cpp:217:7: error: 'parent' was not declared in this scope x=parent[x]; ^ veri.cpp:219:5: error: 'afisa' was not declared in this scope afisa[cont]=x; ^ veri.cpp:221:5: error: 'i' was not declared in this scope for(i=nra;i>=0;i--) ^ veri.cpp:221:7: error: 'nra' was not declared in this scope for(i=nra;i>=0;i--) ^ veri.cpp:222:8: error: 'afisa' was not declared in this scope g<<afisa[i]<<" "; ^ veri.cpp:225:13: error: 'nrb' was not declared in this scope while(cont<=nrb) ^ veri.cpp:229:9: error: 'x' was not declared in this scope x=b; ^ veri.cpp:230:9: error: 'afisb' was not declared in this scope afisb[cont]=b; ^ veri.cpp:234:5: error: 'x' was not declared in this scope x=parent[x]; ^ veri.cpp:234:7: error: 'parent' was not declared in this scope x=parent[x]; ^ veri.cpp:236:5: error: 'afisb' was not declared in this scope afisb[cont]=x; ^ veri.cpp:238:5: error: 'i' was not declared in this scope for(i=nrb;i>=0;i--) ^ veri.cpp:238:7: error: 'nrb' was not declared in this scope for(i=nrb;i>=0;i--) ^ veri.cpp:239:8: error: 'afisb' was not declared in this scope g<<afisb[i]<<" "; ^ veri.cpp:247:9: error: 'x' was not declared in this scope x=S; ^ veri.cpp:248:9: error: 'afisS' was not declared in this scope afisS[cont]=S; ^ veri.cpp:252:5: error: 'x' was not declared in this scope x=parent[x]; ^ veri.cpp:252:7: error: 'parent' was not declared in this scope x=parent[x]; ^ veri.cpp:254:5: error: 'afisS' was not declared in this scope afisS[cont]=x; ^ veri.cpp:256:5: error: 'i' was not declared in this scope for(i=2;i>=0;i--) ^ veri.cpp:257:8: error: 'afisS' was not declared in this scope g<<afisS[i]<<" "; ^ veri.cpp:258:4: error: 'nrS' was not declared in this scope g<<nrS; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema veri 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ă.