Register
|
Login
Home
News
Competitions
Practice
How to
Rankings
Calendar
Arena
CodeFu 2007
CodeFu'07 Highlights
Jazoon'07 Highlights
Schedule
Rules
Prizes
Results
Competitions
»
Main CodeFu Competitons
»
CodeFu 2007
»
Results
CodeFu 2007 Results
CodeFu Final Round Results
aleksovski's solution for 500: NewsFlow, written in Java
public class NewsFlow { int [][] matr; int n; int [] t; public int minutes(String[] willing) { createMatr(willing); t[0]=1; rek(0); int max=-1; for (int i=0;i<n;i++) if (t[i]>max) max=t[i]; return max-1; } private void createMatr(String [] will) { n = will.length; matr = new int[will.length][will.length]; t = new int[n]; for (int i=0;i<n;i++) { String w = will[i].toUpperCase(); for (int j=0;j<n;j++) if (w.charAt(j)=='Y') { matr[i][j]=1; } } } public void rek(int poc) { System.out.println("rek" + poc); for (int j=0;j<n;j++) if (matr[poc][j]>0) if ((t[j]==0) || (t[j] > t[poc]+1)) { t[j] = t[poc]+1; rek(j); } } }