click to add title n.
Skip this Video
Loading SlideShow in 5 Seconds..
Click to add title PowerPoint Presentation
Download Presentation
Click to add title

Loading in 2 Seconds...

play fullscreen
1 / 5

Click to add title - PowerPoint PPT Presentation

  • Uploaded on

Click to add title. Click to add lame programming pun. PotW Solution ( credits to Qingqi ).

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

Click to add title

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
click to add title

Click to add title

Click to add lame programming pun

potw solution credits to qingqi
PotW Solution(credits to Qingqi)

Scanner input=new Scanner(;int v=input.nextInt(), e=input.nextInt();ArrayList<Integer>[] g=newArrayList[v];for(inti=0;i<v;i++) g[i]=newArrayList<Integer>();for(inti=0;i<e;i++) {int a=input.nextInt()-1, b=input.nextInt()-1;   g[a].add(b);   g[b].add(a);}boolean[] visited=newboolean[v];Queue<Integer> q=newLinkedList<Integer>();q.offer(0);visited[0]=true;intcnt=1;while(!q.isEmpty()) {int node=q.poll();for(int n: g[node]) {if(!visited[n]) {                 visited[n]=true;q.add(n);cnt++;          }   }}System.out.println(e==v-1 && cnt==v?"YES":"NO");

take december usaco
Take December USACO!
  • December 9-12
  • You know you want to!
    • Even though it is the weekend before finals…
potw cow trails
PotW- Cow Trails
  • Farmer John wants to create a scenic trail on his field, and has hired you. To maximize your pay, make the trail as long as possible.
  • However, his field has trees on it, and he refuses to cut them down because he is environmentally conscious. Trees are denoted with "Y", and empty spaces are denoted with ".".
  • The trail starts at the top left corner and cannot intersect with itself (it is NOT a loop)

Sample Input:                   Sample Output (not optimal):4 5 (rows columns)     RRRRDLLDDLULD..... .Y... ...Y. .....

The time limit is 10 seconds, and the dimensions of the grid are less than 80. Scoring will be relative to your placing out of all submissions: the kth best will receive 54-3*k points, with ties rounding up.

  • Use System.currentTimeMillis() to make sure your program is done by the end of 10 seconds
  • Try using a random number generator along with multiple trials to get a better solution
    • Note that only your final solution will be graded, so there may be a small amount of luck involved here
  • To improve your solution, try making some random test cases
    • The actual test data will be randomly generated, with a 3x3 empty space at the top left corner, and less than 40% trees
  • GO!
    • You have three weeks to outdo your competitors
  • Rest of the meeting is for discussion/studying