Rank

I'm not the best but I'm trying my best.

# Account Class #AC Motto
151 B05902003 Visitor Class Mon. 175
152 B07902054 Visitor Class Mon. 175 煦庭加油 煦庭加油
153 B06902051 Visitor Class Mon. 174 #ifndef AC #define AC #endif #ifndef AC #define AC #endif
154 B07902067 Class Mon. 174
155 B05902087 Visitor Class Mon. 173
156 B06902049 Visitor Class Mon. 173 摸透C語言,5pG45LiN5YiwQ+e9qeadrwo= 摸透C語言,5pG45LiN5YiwQ+e9qeadrwo=
157 B06902059 Visitor Class Mon. 173
158 B04902081 Visitor Class Mon. 172
159 B06902118 Visitor Class Mon. 172
160 B07902043 Class Mon. 172
161 B07902002 Visitor Class Mon. 172 :( :(
162 B08902015 Class Tue. 172
163 B06902119 Visitor Class Mon. 171
164 B08902065 Class Tue. 171 我不會打CODE 誰來救救我 我不會打CODE 誰來救救我
165 B06902127 Visitor Class Mon. 170
166 B06902054 Visitor Class Mon. 170
167 B04902011 Visitor Class Mon. 169 Barused. Barused.
168 B04902002 Visitor Class Mon. 169
169 B05902049 Visitor Class Mon. 169 喵內~~~ 喵內~~~
170 B08902045 Class Tue. 169 遞迴只應天上有,凡人應當寫迴圈 遞迴只應天上有,凡人應當寫迴圈
171 B08902007 Class Tue. 169 我的腦子ㄋ??? 我的腦子ㄋ???
172 B07902050 Visitor Class Mon. 168
173 B04902006 Visitor Class Mon. 167 學弟學妹+U 學弟學妹+U
174 B04902050 Visitor Class Mon. 167 助教加油,學弟妹加油 助教加油,學弟妹加油
175 B05902013 Visitor Class Mon. 167 Never give up~~ Never give up~~
176 B06902066 Visitor Class Mon. 166 \Lefty Hand Cream/\半臉無敵/ \Lefty Hand Covers/ \Lefty Hand Cream/\半臉無敵/ \Lefty Hand Covers/
177 B08902012 Class Mon. 166 硬幣正面看動漫,反面睡覺,立起來讀書。我丟~ 硬幣正面看動漫,反面睡覺,立起來讀書。我丟~
178 B04902014 Visitor Class Mon. 165 祝大家計程A+! 祝大家計程A+!
179 B05902090 Visitor Class Mon. 165
180 B03902126 Visitor Class Mon. 164 技術長在此,歡迎加入台大遊戲社。 技術長在此,歡迎加入台大遊戲社。
181 B07902011 Visitor Class Mon. 164
182 B07902023 Visitor Class Mon. 164 世界上沒有一維陣列解決不了的東西,如果有的話... 那就開二維陣列 世界上沒有一維陣列解決不了的東西,如果有的話... 那就開二維陣列
183 B04902052 Visitor Class Mon. 163
184 B04902003 Visitor Class Mon. 162 No No No いまが最高! No No No いまが最高!
185 B07902012 Visitor Class Mon. 162 不難過ㄇ 不難過ㄇ
186 B08902087 Class Tue. 162 Python Javascript 萬歲!!!(#`Д´)ノ Python Javascript 萬歲!!!(#`Д´)ノ
187 B08902038 Class Mon. 162 借串徵女友 借串徵女友
188 B08902136 Class Mon. 162 #include<stdio.h> #include<stdlib.h> #include<string.h> #include <stdbool.h> #define maxl 20000 typedef struct acity{ // design your object here int city1; int city2; } City; typedef struct _graph { // design your object here City city[maxl]; int citycnt; int curcnt; } Graph; typedef struct _map{ // design your object here City *ptr[maxl]; int cnt; int ptrtocitycnt[maxl]; } Map; int cmp2(const void *data1,const void *data2){ City **ptr1= (City **)data1; City **ptr2= (City **)data2; if( (*ptr1)->city1 < (*ptr2)->city1) return -1; if((*ptr1)->city1 > (*ptr2)->city1) return 1; if((*ptr1)->city2 < (*ptr2)->city2) return -1; if( (*ptr1)->city2 > (*ptr2)->city2) return 1; return 0; } int cmp(const void *data1,const void *data2){ City *ptr1= (City *)data1; City *ptr2= (City *)data2; if( ptr1->city1 < ptr2->city1) return -1; if( ptr1->city1 > ptr2->city1) return 1; if( ptr1->city2 < ptr2->city2) return -1; if( ptr1->city2 > ptr2->city2) return 1; return 0; } void init(Graph *graph, int M){ graph->citycnt=M; graph->curcnt=0; for(int i=0;i<2*M;i++) for(int j=0;j<2*M;j++){ graph->city[i].city1=0; graph->city[j].city2=0; } } // initialize graph void addRoad(Graph *graph, int city1, int city2){ graph->city[graph->curcnt].city1=city1; graph->city[graph->curcnt].city2=city2; graph->curcnt++; graph->city[graph->curcnt].city1=city2; graph->city[graph->curcnt].city2=city1; graph->curcnt++; } // add roads into graph void normalized(Graph *graph, Map *map) { qsort(graph->city,graph->curcnt,sizeof(City),cmp); int last=-1; map->cnt=0; for(int i=0;i<graph->curcnt;i++){ if ( graph->city[i].city1!=last){ map->ptr[map->cnt]=& (graph->city[i]); map->cnt++; map->ptrtocitycnt[graph->city[i].city1]=0; } map->ptrtocitycnt[graph->city[i].city1]++; last=graph->city[i].city1; } } // sort the roads by indices and build the map. int go(Graph *graph, Map *map, int city1, int city2 , int visited[]){ City **found=bsearch( &city1 , map->ptr,map->cnt,sizeof(City *),cmp2); for(int i=0;i<map->ptrtocitycnt[(*found)->city1];i++){ if( (*found)->city2==city2 ) return 1; if( !visited[ (*found)->city2 ] ){ visited[(*found)->city2 ]=1; if(go(graph,map,(*found)->city2,city2,visited)) return 1; } } return 0; } bool hasPath(Graph *graph, Map *map, int city1, int city2){ // check if two cities are connected int visited[maxl]={0}; if(go(graph,map,city1,city2,visited)) return true; return false; } int main(){ int m; scanf("%d",&m); Graph graph; init(&graph,m); for(int i=0;i<m;i++){ int city1,city2; scanf("%d %d",&city1,&city2); addRoad(&graph,city1,city2); } Map map; normalized( &graph, &map); int q; scanf("%d",&q); for(int i=0;i<q;i++){ int city1,city2; scanf("%d %d",&city1,&city2); if(hasPath(&graph,&map,city1,city2)) printf("There is a path.\n"); else printf("There is no path.\n"); } return 0; } #include<stdio.h> #include<stdlib.h> #include<string.h> #include <stdbool.h> #define maxl 20000 typedef struct acity{ // design your object here int city1; int city2; } City; typedef struct _graph { // design your object here City city[maxl]; int citycnt; int curcnt; } Graph; typedef struct _map{ // design your object here City *ptr[maxl]; int cnt; int ptrtocitycnt[maxl]; } Map; int cmp2(const void *data1,const void *data2){ City **ptr1= (City **)data1; City **ptr2= (City **)data2; if( (*ptr1)->city1 < (*ptr2)->city1) return -1; if((*ptr1)->city1 > (*ptr2)->city1) return 1; if((*ptr1)->city2 < (*ptr2)->city2) return -1; if( (*ptr1)->city2 > (*ptr2)->city2) return 1; return 0; } int cmp(const void *data1,const void *data2){ City *ptr1= (City *)data1; City *ptr2= (City *)data2; if( ptr1->city1 < ptr2->city1) return -1; if( ptr1->city1 > ptr2->city1) return 1; if( ptr1->city2 < ptr2->city2) return -1; if( ptr1->city2 > ptr2->city2) return 1; return 0; } void init(Graph *graph, int M){ graph->citycnt=M; graph->curcnt=0; for(int i=0;i<2*M;i++) for(int j=0;j<2*M;j++){ graph->city[i].city1=0; graph->city[j].city2=0; } } // initialize graph void addRoad(Graph *graph, int city1, int city2){ graph->city[graph->curcnt].city1=city1; graph->city[graph->curcnt].city2=city2; graph->curcnt++; graph->city[graph->curcnt].city1=city2; graph->city[graph->curcnt].city2=city1; graph->curcnt++; } // add roads into graph void normalized(Graph *graph, Map *map) { qsort(graph->city,graph->curcnt,sizeof(City),cmp); int last=-1; map->cnt=0; for(int i=0;i<graph->curcnt;i++){ if ( graph->city[i].city1!=last){ map->ptr[map->cnt]=& (graph->city[i]); map->cnt++; map->ptrtocitycnt[graph->city[i].city1]=0; } map->ptrtocitycnt[graph->city[i].city1]++; last=graph->city[i].city1; } } // sort the roads by indices and build the map. int go(Graph *graph, Map *map, int city1, int city2 , int visited[]){ City **found=bsearch( &city1 , map->ptr,map->cnt,sizeof(City *),cmp2); for(int i=0;i<map->ptrtocitycnt[(*found)->city1];i++){ if( (*found)->city2==city2 ) return 1; if( !visited[ (*found)->city2 ] ){ visited[(*found)->city2 ]=1; if(go(graph,map,(*found)->city2,city2,visited)) return 1; } } return 0; } bool hasPath(Graph *graph, Map *map, int city1, int city2){ // check if two cities are connected int visited[maxl]={0}; if(go(graph,map,city1,city2,visited)) return true; return false; } int main(){ int m; scanf("%d",&m); Graph graph; init(&graph,m); for(int i=0;i<m;i++){ int city1,city2; scanf("%d %d",&city1,&city2); addRoad(&graph,city1,city2); } Map map; normalized( &graph, &map); int q; scanf("%d",&q); for(int i=0;i<q;i++){ int city1,city2; scanf("%d %d",&city1,&city2); if(hasPath(&graph,&map,city1,city2)) printf("There is a path.\n"); else printf("There is no path.\n"); } return 0; }
189 B06902068 Visitor Class Mon. 161
190 B08902132 Class Mon. 161
191 B04902007 Visitor Class Mon. 160 崩潰喔 吃土ㄅ 崩潰喔 吃土ㄅ
192 B06902006 Visitor Class Mon. 159
193 B05902053 Visitor Class Mon. 158 我是一隻誤入叢林的白兔 我就是我自己的神,在我活的地方~(由G大調轉A大調) 下一站,是不是天堂,就算失望,不能絕望! 就這一次!我和我的倔強! 我是一隻誤入叢林的白兔 我就是我自己的神,在我活的地方~(由G大調轉A大調) 下一站,是不是天堂,就算失望,不能絕望! 就這一次!我和我的倔強!
194 B07902003 Visitor Class Mon. 158
195 B07902019 Visitor Class Mon. 158 6*9=42 6*9=42
196 B08902057 Class Tue. 158 才不是。痛有夠討厭。 才不是。痛有夠討厭。
197 B04902045 Visitor Class Mon. 157
198 B05902077 Visitor Class Mon. 157
199 B06902017 Visitor Class Mon. 157 爆ぜろリアル!弾けろシナプス!バニッシュメント・ディス・ワールド! 爆ぜろリアル!弾けろシナプス!バニッシュメント・ディス・ワールド!
200 B06902131 Visitor Class Mon. 157