## Search found 12 matches

Fri Sep 27, 2013 11:44 am
Forum: Volume 114 (11400-11499)
Topic: 11402 - Ahoy, Pirates!
Replies: 45
Views: 15952

### Re: 11402 - Ahoy, Pirates

Hi...

I used segment tree with lazy propagation to update for this problem.
But I'm getting WA!
Is there any tricky case?!

Here's my code: http://ideone.com/4NNbV5

Fri Feb 15, 2013 11:33 am
Forum: Algorithms
Topic: Sieve of Eratosthenes Time Complexity
Replies: 1
Views: 2487

### Sieve of Eratosthenes Time Complexity

Hi...

What is the time complexity of Sieve of Eratosthenes algorithm to find prime numbers?
How to calculate it? Please describe it...

Thu Nov 22, 2012 2:38 pm
Forum: Algorithms
Topic: USACO - Dynamic Programming
Replies: 0
Views: 2891

### USACO - Dynamic Programming

I've read this problem in the USACO Training Pages. Here's the problem description... " You have just won a contest where the prize is a free vacation in Canada. You must travel via air, and the cities are ordered from east to west. In addition, according to the rules, you must start at the further ...
Thu Nov 15, 2012 2:25 pm
Forum: Algorithms
Topic: USACO — Dynamic Programming — Longest Common Subsequence
Replies: 2
Views: 3260

### Re: USACO — Dynamic Programming — Longest Common Subsequence

Thank for replying and good link! I know this solution and It is like my solution.It iterate on the X and Y from the first to last, but my solution iterate on X and Y from the last to first! Here it is the solution: http://upload.wikimedia.org/math/e/4/9/e49ef6db695cb7edc3da7d67325fd97a.png But in t...
Wed Nov 14, 2012 3:12 pm
Forum: Algorithms
Topic: USACO — Dynamic Programming — Longest Common Subsequence
Replies: 2
Views: 3260

### USACO — Dynamic Programming — Longest Common Subsequence

I've used this recursive relation to solve this classic problem. Here it is: if (I == n || J == m) dp[I][J] = 0; else if (x[I] == y[J]) dp[I][J] = dp[I+1][J+1] + 1; else dp[I][J] = max (dp[I+1][J], dp[I][J+1]); but I've seen the USACO TEXT about Dynamic Programming, that it used this pseudocode for ...
Wed Aug 22, 2012 3:55 pm
Forum: Volume 7 (700-799)
Topic: 749 - Machine Repair Simulation
Replies: 3
Views: 2350

### 749 - Machine Repair Simulation

Hi... I solved this problem, but I don't get how to show the result in output file! Is there anybody to clarify? for example, How is the output file for these cases? How we show them in output file? Here's the cases: 1) case=10 No of Machines=3 Utilization Machine=0.525 Utilization Repairman=0.475 2...
Wed Jul 18, 2012 10:03 am
Forum: Volume 114 (11400-11499)
Topic: 11472 - Beautiful Numbers
Replies: 13
Views: 3102

### 11472 - Beautiful Numbers

hi... I've written this code for 11472 but it takes RUNTIME ERROR! I don't know what is it's reason!!! please help me to solve this problem... thanks! here's my code: #include <iostream> #include <cstring> #include <cmath> using namespace std; int dp[101][10][1024]; int res; int main () { memset (dp...
Fri Jun 08, 2012 2:35 pm
Forum: Volume 7 (700-799)
Topic: 723 - Comment Removal
Replies: 16
Views: 10090

### 723 - Comment Removal_Clarification

hi everyone...
anybody knows the output for my output?

input:

Code: Select all

``````begin;
myfunc { nothing } }
(* comment *  )   *)

(*
*
)
*)

end;
``````
tnx...
Fri Jun 08, 2012 2:25 pm
Forum: Volume 7 (700-799)
Topic: 723 - Comment Removal
Replies: 16
Views: 10090

### Clarification

hi everyone...
anybody knows the output for my output?

input:

Code: Select all

``````begin;
myfunc { nothing } }
(* comment *  )   *)

(*
*
)
*)

end;
``````
tnx...
Fri Jun 01, 2012 3:13 pm
Forum: Volume 5 (500-599)
Topic: 567 - Risk
Replies: 46
Views: 17053

### Re: WA in 567

yes...you're true!!!
thanks a lot...
Fri Jun 01, 2012 12:45 pm
Forum: Volume 102 (10200-10299)
Topic: 10227 - Forests
Replies: 23
Views: 9166

### WA for 10227 - Forests

hi... I've coded this question but it's got WA... here's my code: #include <iostream> #include <sstream> #include <vector> #include <string> #include <algorithm> #include <set> using namespace std; int main() { //freopen ("10227.in", "r", stdin); int t; cin >> t; string str; getline (cin, str); getl...
Tue May 29, 2012 9:13 pm
Forum: Volume 5 (500-599)
Topic: 567 - Risk
Replies: 46
Views: 17053

### WA in 567

Hi...I've used bfs algorithm to solve this problem...it past sample input and some another testcases I've test...but I don't know why it goes wrong!!! Here's my code... #include <iostream> #include <queue> #include <cstring> #include <stdio.h> using namespace std; int mat[21][21]; int mark[21]; int ...