From 10f6ccbb4c699048e54db3c4b9ca9fce0c1dc950 Mon Sep 17 00:00:00 2001 From: Aditya Naik Date: Sat, 12 May 2018 23:11:09 -0400 Subject: f#ing finally --- 10009/roads.cpp | 46 +++++++++++++++++++++++++++++----------------- 10009/roads.in | 39 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 66 insertions(+), 19 deletions(-) diff --git a/10009/roads.cpp b/10009/roads.cpp index 9198847..4ce43b8 100644 --- a/10009/roads.cpp +++ b/10009/roads.cpp @@ -6,6 +6,8 @@ using namespace std; bool print_path(int [][26], int start, int dest, string &path, bool visited[]); +string reverse(string in); + int main(){ int tc; cin>>tc; @@ -13,7 +15,7 @@ int main(){ int r, q, c1, c2; char city1[100], city2[100]; - int map[26][26] = {0}; + int map[26][26] = {0}; cin>>r>>q; while(r--){ cin>>city1>>city2; @@ -22,20 +24,35 @@ int main(){ map[c1][c2] = 1; map[c2][c1] = 1; - } - + } + while(q--){ - string path=""; int i=0;bool viz[26]; + string path=""; + bool viz[26]={false}; cin>>city1>>city2; c1 = (int)city1[0] % 65; c2 = (int)city2[0] % 65; print_path(map, c1, c2, path, viz); - cout<0) + cout<