## Search found 100 matches

Fri Jul 27, 2007 11:16 am
Forum: C++
Topic: Initialize a Queue Empty
Replies: 5
Views: 2787

### Initialize a Queue Empty

suppose i have declared : queue<int> Q; I want this Q empty at the beginning of each interation: t=0; while(t--) { //here I need the Queue empty // here are oprations with that Q which may leave the queue un-empty at the end } what should I do to make my Q empty each time ?? Thanks in advance
Sun Jul 15, 2007 9:57 pm
Forum: Volume 106 (10600-10699)
Topic: 10610 - Gopher and Hawks
Replies: 29
Views: 12678
I have used DFS approach with DP . I have absolute no idea why I am getting TLE . Is there anything wrong in my input taking or the algo is too slow?? I found in this forum that people used BFS to have solved this problem.So, using DFS would not be algorithmically slower. here is my code .. #include...
Sun Jul 15, 2007 5:42 pm
Forum: Volume 112 (11200-11299)
Topic: 11235 - Frequent values
Replies: 35
Views: 15769
Thank you very much.

I really misunderstood the problem , Now I have got it. Hope , I will get it solved soon . Thanks once again !
Thu Jul 12, 2007 6:17 pm
Forum: Volume 112 (11200-11299)
Topic: 11235 - Frequent values
Replies: 35
Views: 15769
sorry .. but I think,the possible input can be 78. -1 to 10 , there are 12 numbers. what I found from my code seemed to be correct with my calculation. for input 10 78 -1 -1 1 1 1 1 3 10 10 10 I found the result (with query) from: -1 to: -1 ans is: 2 from: -1 to: 0 ans is: 2 from: -1 to: 1 ans is: 4...
Wed Jul 11, 2007 3:21 pm
Forum: Volume 112 (11200-11299)
Topic: 11235 - Frequent values
Replies: 35
Views: 15769
any one help me checking some input for my code pasted above ??
Tue Jul 10, 2007 4:25 pm
Forum: Volume 112 (11200-11299)
Topic: 11235 - Frequent values
Replies: 35
Views: 15769
I am getting bored of TLEs. I have taken input in O(n*logn) and processesd each query on O(logn). This should not exceed the time limit. Is there any tricky one to hault my program or is it just too slow?? can anyone check my code, plz ?? #include<stdio.h> #include<string.h> #define INF 100005 class...
Tue Jul 10, 2007 4:02 pm
Forum: Volume 112 (11200-11299)
Topic: 11235 - Frequent values
Replies: 35
Views: 15769
sorry.
i got my mistake , j should be less than n , not an
Tue Jul 10, 2007 4:00 pm
Forum: Volume 112 (11200-11299)
Topic: 11235 - Frequent values
Replies: 35
Views: 15769
This one maybe is a bit tricky. 7 1 1 2 2 2 2 2 3 3 5 0 Output: 3 If it didn't help, you could write a simple brute force solution and cross-check its output with your solution on random cases. well , I dont understand , why this input is valid, coz in the roblem statement they wrote , The followin...
Tue Jul 10, 2007 3:54 pm
Forum: Volume 112 (11200-11299)
Topic: 11232 - Cylinder
Replies: 34
Views: 15282
here is the output of my AC code for ur input: input: 30 35 30 36 30 37 30 38 30 39 30 40 30 41 30 42 30 43 30 44 30 45 30 46 30 47 30 48 30 49 30 50 30 51 30 52 30 53 30 54 30 55 30 56 30 57 30 58 30 59 30 60 30 61 30 62 30 63 30 64 30 65 30 66 30 67 30 68 30 69 30 70 30 71 30 72 30 73 30 74 30 75 ...
Mon Jul 09, 2007 9:48 pm
Forum: Volume 1 (100-199)
Topic: 193 - Graph Coloring
Replies: 93
Views: 20801
its not a bi-colorable problem , because two whites can be adjacent. Any way , is there any tricky input to dodge my code ??
Mon Jul 09, 2007 6:23 pm
Forum: Volume 112 (11200-11299)
Topic: 11234 - Expressions
Replies: 15
Views: 7127
Oh My GOD! What is going on with me !! I made this code during the contest and could not get AC for this 2 silly mistakes !! really frustrating. If some problems are missed which I really cant solve doesnt cause me that much pain , but this type of missing is really embarrassing ! :cry: Anyway , mf ...
Mon Jul 09, 2007 4:47 pm
Forum: Volume 112 (11200-11299)
Topic: 11234 - Expressions
Replies: 15
Views: 7127
Thank you very much :) , I did not notice that is not being cleaned. Now I have cleaned it. But unfortunately , this time I am getting WA. here is the changed code ( just cleaned the queue) removed after AC To mf, thank you very much for your advice , I am at very beginning stage of STL learning. I ...
Sun Jul 08, 2007 2:58 pm
Forum: Volume 1 (100-199)
Topic: 193 - Graph Coloring
Replies: 93
Views: 20801
I used a Brute Force method . I tried to paint every node BLACK and then tried to find the solution. I did dot get TLE from judge, rather I got WA !! But my code gave right answers for all the inputs I found. Anyone can help me ?? #include<stdio.h> #include<string.h> #define BLACK 1 #define WHITE 2 ...
Sat Jul 07, 2007 7:26 pm
Forum: Volume 112 (11200-11299)
Topic: 11234 - Expressions
Replies: 15
Views: 7127

### 11234 - Expressions

i am getting runtime error signal 11 (SIGSEGV). for this code :
But I cant find why ??

Anybody to help me??

Code: Select all

``````removed after AC
``````
Thu Jul 05, 2007 5:25 pm
Forum: Volume 112 (11200-11299)
Topic: 11228 - Transportation system.
Replies: 30
Views: 12739
how the Prims algo can be implemented in O(n) ??
Do you use Fibonacci Heap ?? Please let me know the trick ..

Thank you