@@ -37,7 +37,7 @@ Library file for cluster0.
3737This contains shared code that can be imported by problems in this cluster.
3838"""` ,
3939
40- "580_c_kefa_and_park_5570/ " : {
40+ "580_c_kefa_and_park_5570" : {
4141 "PROBLEM.md" : `# 580_C. Kefa and Park
4242
4343**ID:** 580_c_kefa_and_park_5570
@@ -85,7 +85,7 @@ while i<len(q):
8585 i+=1
8686print(a)` ,
8787 "tags.txt" : "dfs and similar\\ngraphs\\ntrees" ,
88- "tests/ " : {
88+ "tests" : {
8989 "input_1.txt" : "7 1\\n1 0 1 1 0 0 0\\n1 2\\n1 3\\n2 4\\n2 5\\n3 6\\n3 7" ,
9090 "output_1.txt" : "2" ,
9191 "input_2.txt" : "4 1\\n1 1 0 0\\n1 2\\n1 3\\n1 4" ,
@@ -109,7 +109,7 @@ print(a)`,
109109 }
110110 } ,
111111
112- "116_c_party_7303/ " : {
112+ "116_c_party_7303" : {
113113 "PROBLEM.md" : `# 116_C. Party
114114
115115**ID:** 116_c_party_7303
@@ -177,7 +177,7 @@ for i in range(n):
177177
178178print(max([findDepth(a, i) for i in roots]))` ,
179179 "tags.txt" : "dfs and similar\\ngraphs\\ntrees" ,
180- "tests/ " : {
180+ "tests" : {
181181 "input_1.txt" : "5\\n-1\\n1\\n2\\n1\\n-1" ,
182182 "output_1.txt" : "3" ,
183183 "input_2.txt" : "12\\n-1\\n8\\n9\\n-1\\n4\\n2\\n11\\n1\\n-1\\n6\\n-1\\n10" ,
@@ -201,7 +201,7 @@ print(max([findDepth(a, i) for i in roots]))`,
201201 }
202202 } ,
203203
204- "292_b_network_topology_9930/ " : {
204+ "292_b_network_topology_9930" : {
205205 "PROBLEM.md" : `# 292_B. Network Topology
206206
207207**ID:** 292_b_network_topology_9930
@@ -248,7 +248,7 @@ elif c1==n-1 and cs==1:
248248else:
249249 print("unknown topology")` ,
250250 "tags.txt" : "graphs\\nimplementation" ,
251- "tests/ " : {
251+ "tests" : {
252252 "input_1.txt" : "4 3\\n1 2\\n2 3\\n3 4" ,
253253 "output_1.txt" : "bus topology" ,
254254 "input_2.txt" : "4 4\\n1 2\\n2 3\\n3 4\\n4 1" ,
@@ -272,7 +272,7 @@ else:
272272 }
273273 } ,
274274
275- "913_b_christmas_spruce_7977/ " : {
275+ "913_b_christmas_spruce_7977" : {
276276 "PROBLEM.md" : `# 913_B. Christmas Spruce
277277
278278**ID:** 913_b_christmas_spruce_7977
@@ -321,7 +321,7 @@ if __name__ == '__main__':
321321
322322 print("Yes")` ,
323323 "tags.txt" : "implementation\\ntrees" ,
324- "tests/ " : {
324+ "tests" : {
325325 "input_1.txt" : "4\\n1\\n1\\n1" ,
326326 "output_1.txt" : "Yes" ,
327327 "input_2.txt" : "8\\n1\\n1\\n1\\n1\\n3\\n3\\n3" ,
@@ -345,7 +345,7 @@ if __name__ == '__main__':
345345 }
346346 } ,
347347
348- "982_c_cut_em_all_5275/ " : {
348+ "982_c_cut_em_all_5275" : {
349349 "PROBLEM.md" : `# 982_C. Cut 'em all!
350350
351351**ID:** 982_c_cut_em_all_5275
@@ -403,7 +403,7 @@ t = threading.Thread(target=main)
403403t.start()
404404t.join()` ,
405405 "tags.txt" : "dfs and similar\\ndp\\ngraphs\\ngreedy\\ntrees" ,
406- "tests/ " : {
406+ "tests" : {
407407 "input_1.txt" : "4\\n2 4\\n4 1\\n3 1" ,
408408 "output_1.txt" : "1" ,
409409 "input_2.txt" : "2\\n1 2" ,
@@ -446,10 +446,15 @@ t.join()`,
446446 <h3>🗂️ MiniCode CodeContests Collection (Before Refactoring)</h3>
447447 <div class="filesystem-path">
448448 <span class="path-segment" data-path="">📁 cluster0</span>
449- ${ this . currentPath . map ( ( segment , index ) =>
450- `<span class="path-separator">/</span>
451- <span class="path-segment" data-path="${ this . currentPath . slice ( 0 , index + 1 ) . join ( '/' ) } ">${ segment } </span>`
452- ) . join ( '' ) }
449+ ${ this . currentPath . map ( ( segment , index ) => {
450+ const pathToHere = this . currentPath . slice ( 0 , index + 1 ) . join ( '/' ) ;
451+ // Check if this is a valid navigation target (not the final file)
452+ const isValidNavTarget = index < this . currentPath . length - 1 || typeof this . getCurrentDirectory ( ) === 'object' ;
453+ const clickHandler = isValidNavTarget ? `data-path="${ pathToHere } "` : '' ;
454+ const className = isValidNavTarget ? 'path-segment' : 'path-segment path-segment-file' ;
455+ return `<span class="path-separator">/</span>
456+ <span class="${ className } " ${ clickHandler } >${ segment } </span>` ;
457+ } ) . join ( '' ) }
453458 </div>
454459 </div>
455460 <div class="filesystem-content">
@@ -527,7 +532,28 @@ t.join()`,
527532 if ( path === '' ) {
528533 this . currentPath = [ ] ;
529534 } else {
530- this . currentPath = path . split ( '/' ) . filter ( p => p ) ;
535+ const segments = path . split ( '/' ) . filter ( p => p ) ;
536+ // For the filesystem structure, problems are at root level
537+ // So we just need to validate that the full path exists
538+ let current = this . filesystem ;
539+ let validPath = [ ] ;
540+
541+ for ( const segment of segments ) {
542+ if ( current && typeof current === 'object' && current [ segment ] !== undefined ) {
543+ current = current [ segment ] ;
544+ validPath . push ( segment ) ;
545+ } else {
546+ break ;
547+ }
548+ }
549+
550+ // Only navigate if we found a valid directory path
551+ if ( validPath . length === segments . length && typeof current === 'object' ) {
552+ this . currentPath = validPath ;
553+ } else if ( validPath . length > 0 ) {
554+ // Navigate to the deepest valid directory
555+ this . currentPath = validPath ;
556+ }
531557 }
532558 this . render ( ) ;
533559 }
0 commit comments