Pagini recente » Borderou de evaluare (job #861672) | Borderou de evaluare (job #1858671) | Borderou de evaluare (job #2701059) | Borderou de evaluare (job #891360) | Borderou de evaluare (job #2417650)
Borderou de evaluare (job #2417650)
Raport evaluator
Compilare:
main.cpp:2:69: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
using namespace std;ifstream I("bfs.in");ofstream O("bfs.out");main(){int n,m,s;I>>n>>m>>s;vector<vector<int>>A(n+1,vector<int>());for(int i=1;i<=m;i++){int x,y;I>>x>>y;A[x].push_back(y);}vector<int>D(n+1);vector<bool>u(n+1);queue<int>q({s});while(!q.empty()){int N=q.front();q.pop();u[N]=1;for(auto i:A[N])if(!u[i]){u[i]=1;D[i]=D[N]+1;q.push(i);}}for(int i=1;i<=n;i++)O<<(!D[i]?(i==s?0:-1):D[i])<<' ';}
^
Test |
Timp executie |
Memorie folosita |
Mesaj |
Punctaj/test |
1 | 3ms | 131kb | OK | 10 |
2 | 2ms | 131kb | OK | 10 |
3 | 3ms | 131kb | OK | 10 |
4 | 9ms | 245kb | OK | 10 |
5 | 20ms | 307kb | OK | 10 |
6 | 59ms | 1572kb | OK | 10 |
7 | 241ms | 3923kb | OK | 10 |
8 | 220ms | 5758kb | OK | 10 |
9 | 874ms | 11665kb | OK | 10 |
10 | 950ms | 11587kb | OK | 10 |
Punctaj total | 100 |