| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 117159 | onjo0127 | 철도 요금 (JOI16_ho_t3) | C++11 | 178 ms | 17536 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
struct edge {
int u, v, t;
} E[200009];
vector<pii> adj[100009];
int dep[100009], D[100009], dif[200009];
int main() {
int N, M, Q; scanf("%d%d%d",&N,&M,&Q);
for(int i=1; i<=M; i++) {
scanf("%d%d", &E[i].u, &E[i].v);
E[i].t = Q+1;
}
for(int i=1; i<=Q; i++) {
int foo; scanf("%d",&foo);
E[foo].t = i;
}
for(int i=1; i<=M; i++) {
int x = E[i].u, y = E[i].v, c = E[i].t;
adj[x].push_back({y, c});
adj[y].push_back({x, c});
}
queue<int> que; que.push(1); dep[1] = 1; D[1] = Q+1;
int d = 1;
while(que.size()) {
int sz = que.size();
while(sz--) {
int now = que.front(); que.pop();
++dif[D[now]];
for(auto& it: adj[now]) {
if(!dep[it.first]) {
dep[it.first] = d + 1;
D[it.first] = min(D[now], it.second);
que.push(it.first);
}
else if(dep[it.first] == d + 1) {
D[it.first] = max(D[it.first], min(D[now], it.second));
}
}
}
++d;
}
for(int i=1, s=0; i<=Q; i++) {
s += dif[i];
printf("%d\n",s);
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
