# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
343206 | 2021-01-03T14:23:52 Z | benedict0724 | One-Way Streets (CEOI17_oneway) | C++17 | 2057 ms | 512 KB |
#include <bits/stdc++.h> using namespace std; vector<int> adj[1002]; pair<int, int> road[1002]; pair<int, int> haveTo[1002]; bool visited[1002]; bool poss = false; void dfs(int x, int s, int e, int g){ visited[x] = true; if(x == g){ poss = true; return; } for(auto u : adj[x]){ if(!visited[u] && (x != s || u != e)){ dfs(u, s, e, g); if(poss) return; } } } int main() { int n, m; scanf("%d %d", &n, &m); for(int i=1;i<=m;i++){ int s, e; scanf("%d %d", &s, &e); adj[s].push_back(e); adj[e].push_back(s); road[i] = {s, e}; } int p; scanf("%d", &p); for(int i=1;i<=p;i++){ int s, e; scanf("%d %d", &s, &e); haveTo[i] = {s, e}; } for(int i=1;i<=m;i++){ int s = road[i].first, e = road[i].second; bool toR = true, toL = true; for(int j=1;j<=p;j++){ for(int k=1;k<=n;k++){ visited[k] = false; } poss = false; dfs(haveTo[j].first, s, e, haveTo[j].second); if(!poss){ toR = false; } for(int k=1;k<=n;k++){ visited[k] = false; } poss = false; dfs(haveTo[j].first, e, s, haveTo[j].second); if(!poss){ toL = false; } } if(toR && toL) printf("B"); else if(toR) printf("L"); else printf("R"); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 98 ms | 364 KB | Output is correct |
4 | Correct | 110 ms | 492 KB | Output is correct |
5 | Correct | 2057 ms | 496 KB | Output is correct |
6 | Correct | 723 ms | 460 KB | Output is correct |
7 | Correct | 1183 ms | 484 KB | Output is correct |
8 | Correct | 974 ms | 492 KB | Output is correct |
9 | Incorrect | 1297 ms | 512 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 98 ms | 364 KB | Output is correct |
4 | Correct | 110 ms | 492 KB | Output is correct |
5 | Correct | 2057 ms | 496 KB | Output is correct |
6 | Correct | 723 ms | 460 KB | Output is correct |
7 | Correct | 1183 ms | 484 KB | Output is correct |
8 | Correct | 974 ms | 492 KB | Output is correct |
9 | Incorrect | 1297 ms | 512 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 98 ms | 364 KB | Output is correct |
4 | Correct | 110 ms | 492 KB | Output is correct |
5 | Correct | 2057 ms | 496 KB | Output is correct |
6 | Correct | 723 ms | 460 KB | Output is correct |
7 | Correct | 1183 ms | 484 KB | Output is correct |
8 | Correct | 974 ms | 492 KB | Output is correct |
9 | Incorrect | 1297 ms | 512 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |