# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
101514 | cheeheng | 007 (CEOI14_007) | C++14 | 344 ms | 15736 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
vector<int> AdjList[200005];
int dist[200005];
int main(){
int N, M;
int s, d, a, b;
scanf("%d%d%d%d%d%d", &N, &M, &s, &d, &a, &b);
for(int i = 0; i < M; i ++){
int x, y;
scanf("%d%d", &x, &y);
AdjList[x].push_back(y);
AdjList[y].push_back(x);
}
memset(dist, -1, sizeof(dist));
queue<int> q;
q.push(s);
dist[s] = 0;
while(!q.empty()){
int u = q.front(); q.pop();
for(int v: AdjList[u]){
if(dist[v] == -1){
dist[v] = dist[u] + 1;
q.push(v);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |