Search found 14 matches

by EduardoQuintana
4 years ago
Forum: Algorithms
Topic: Finding Articulation Points
Replies: 1
Views: 1715
Gender: None specified

Finding Articulation Points

Does anyone knows why the following algorithm is used for finding articulation points?: void dfs(int v, int p){ disc[v]=back[v]=++depth; for(viit i=adj[v].begin(); i!=adj[v].end(); i++)if(*i != p){ if(!disc[*i]){ dfs(*i,v); back[v]=min(back[v],back[*i]); if((disc[v]!=1 && disc[v]<=back[*i])||(disc[v...
by EduardoQuintana
6 years ago
Forum: Problem set
Topic: 2537 - Assassins of the Three Kingdoms
Replies: 4
Views: 1096
Gender: None specified

Re: 2537 - Assassins of the Three Kingdoms

Prueba usando:
input:
1
3
0 0 1

output
3

ok, fixed
by EduardoQuintana
6 years ago
Forum: Problem set
Topic: 2497 - LCM Pair Sum
Replies: 5
Views: 2360
Gender: None specified

Re: 2497 - LCM Pair Sum

Can anybody tell me please: Why this code gives TLE?
Its complexity is O(T*C*a),
T<=500
C<=15
a<=50
by EduardoQuintana
6 years ago
Forum: Problem set
Topic: 2517 - LCA for Strings
Replies: 2
Views: 734
Gender: None specified

Re: 2517 - LCA for Strings

This problem is similar to "LCM pair sum", visit this topic http://coj-forum.uci.cu/viewtopic.php?f=22&t=1755&sid=03a9667a66bb709182fffdbab20db889 once we define S>>T as having S >=T for all 1<=i<=|S| Given the strings AS and BS. Creating the lexicographically smallest string LLS such that LLS>>AS a...
by EduardoQuintana
6 years ago
Forum: Problem set
Topic: 2517 - LCA for Strings
Replies: 2
Views: 734
Gender: None specified

Re: 2517 - LCA for Strings

Referees should fix the problem statement. Since the alphabet is L={a1,a2,...,ak}. And if S>>T we have S >T for each 1<=i<=|S| Then if S: 2 2 2 There exist only one T: 1 1 1 2 > 1, 2>1, 2>1, and 1>=1, 1>=1, 1>=1 Now, either you let the alphabet grow to L={a0,a1,a2,...,ak}, allowing: T: 0 0 0, 0 0 1,...
by EduardoQuintana
6 years ago
Forum: Problem set
Topic: 2497 - LCM Pair Sum
Replies: 5
Views: 2360
Gender: None specified

Re: 2497 - LCM Pair Sum

First of all: I think few people actually read these posts, but I don't have any other choice than posting here since 'nobody' replies messages. Thanks for all people who does, and apologies. Any number can be represented as the product of power of its prime factors. Example: 18= 2^1 * 3^2 * 5^0, in...
by EduardoQuintana
6 years ago
Forum: Problem set
Topic: 2061 - Power Sum
Replies: 3
Views: 801
Gender: None specified

Re: 2061 - Power Sum

By definition: S(x,n)=1+x+x^2+...+x^n Given x, n and P=1000000007; you need to find S(x,n)%P. *(a%b, means the remainder from dividing the integer numbers a and b) First note that: S(x,n)={ =n+1 [if x==1]; =(x^(n+1)-1)/(x-1) [otherwise]; } [eq0] So it looks simple, just calculate S(x,n)%P=( (x^(n+1)...
by EduardoQuintana
6 years ago
Forum: Problem set
Topic: 2469 - ChronSort
Replies: 3
Views: 645
Gender: None specified

Re: 2469 - ChronSort

para el caso:

6
a b c q e n
a b c q e n

la salida correcta es: 15/15
by EduardoQuintana
6 years ago
Forum: Problem set
Topic: 2480 - DEJAVU
Replies: 1
Views: 298
Gender: None specified

Re: 2480 - DEJAVU

Three points (A,B,C) forming a right triangle with legs parallel to the axis. Where C is opposite to the hypotenuse, the edge AC is parallel to the OY axis and the edge BC is parallel to the OX axis Something like this: A | | C---B Or: ____A ____| ____| B---C or: C---B | | A or: B---C ____| ____| __...
by EduardoQuintana
6 years ago
Forum: Problem set
Topic: 2456 - Kisses and Handshakes
Replies: 2
Views: 655
Gender: None specified

Re: 2456 - Kisses and Handshakes

This problem states, every participant has greeted every other participant. But it doesn't reads "greeted only once". This should be fixed by the problemsetters. If it is allowed to greet more than once, then every case has multiple solution. Example: K=15 and H=6. 2 men could have shake hands 6 tim...

Go to advanced search