I've used the Merge Sort approach and got Accepted with the long datatype. So, now a days I think long long is not necessary for this problem.
( <---- 24 November, 2010)
Also got Accepted in the BST approach... but it took greater runtime.
Search found 10 matches
- Wed Nov 24, 2010 4:27 pm
- Forum: Volume 108 (10800-10899)
- Topic: 10810 - Ultra-QuickSort
- Replies: 36
- Views: 27672
- Sat Nov 13, 2010 2:13 pm
- Forum: Volume 1 (100-199)
- Topic: 127 - "Accordian" Patience
- Replies: 83
- Views: 21343
Re: 127 ...
I just added two arrays next[52] and prev[52] for each piles and used those in the previous code. Now its Runtime is 0.256 sec that places me within the Top 20 List for this problem. And I am satisfied with this. 

- Sat Nov 13, 2010 12:26 pm
- Forum: Volume 1 (100-199)
- Topic: 127 - "Accordian" Patience
- Replies: 83
- Views: 21343
Re: 127 ...
I also had started with STL stack & vector like stcheung and got TLE.
Then I used a data structure like:
struct pile{
char card[52][2];
int top;
} piles[52];
I just skipped the empty piles while traversing.
though it took 1.552 sec , but I got Accepted. :wink:
Now I am trying to improve the ...
Then I used a data structure like:
struct pile{
char card[52][2];
int top;
} piles[52];
I just skipped the empty piles while traversing.
though it took 1.552 sec , but I got Accepted. :wink:
Now I am trying to improve the ...
- Tue Sep 18, 2007 12:07 pm
- Forum: Volume 100 (10000-10099)
- Topic: 10099 - The Tourist Guide
- Replies: 91
- Views: 43033
- Mon Sep 17, 2007 11:53 am
- Forum: Volume 108 (10800-10899)
- Topic: 10806 - Dijkstra, Dijkstra.
- Replies: 24
- Views: 20397
10806 Wrong Answer
I have used Dijkstra.
I have Read the Post of Misof in the board But didn't understand How to initialize the cost/weight-matrix .
I have Initialized The Weight-Matrix as follows:
For each edge (a,b) I have set W[a] = W [a] = dist :-?
Then I have (tried to) find the first shortest path using ...
I have Read the Post of Misof in the board But didn't understand How to initialize the cost/weight-matrix .
I have Initialized The Weight-Matrix as follows:
For each edge (a,b) I have set W[a] = W [a] = dist :-?
Then I have (tried to) find the first shortest path using ...
- Wed Jun 27, 2007 5:56 pm
- Forum: Volume 108 (10800-10899)
- Topic: 10856 - Recover Factorial
- Replies: 17
- Views: 17115
W. A. 10856
I have tried the I/Os of the Board. Those are all OK.
But I get WA.
But I get WA.
- Sun Jun 24, 2007 4:12 pm
- Forum: Volume 3 (300-399)
- Topic: 362 - 18,000 Seconds Remaining
- Replies: 75
- Views: 38621
362 P.E.
Here is My Code For Which I Have got P.E.
#include<stdio.h>
#include<math.h>
int main(void)
{
double tb,takenTotal,takenPrev5,take;
long t,dataset = 1;
bool tag = false;
scanf("%lf",&tb);
while(tb!=0)
{
if(tag == false) tag = true;
else printf("\n");
...
...
...
...
...
dataset ...
#include<stdio.h>
#include<math.h>
int main(void)
{
double tb,takenTotal,takenPrev5,take;
long t,dataset = 1;
bool tag = false;
scanf("%lf",&tb);
while(tb!=0)
{
if(tag == false) tag = true;
else printf("\n");
...
...
...
...
...
dataset ...
- Fri Jan 12, 2007 8:53 pm
- Forum: Volume 100 (10000-10099)
- Topic: 10010 - Where's Waldorf?
- Replies: 42
- Views: 26024
10010 W.A. Help Please
Pleeeee...........ase Help me.
:roll:
I am getting WA in it.
Can Anyone give me some critical I/O Sets.?
Here Is My Code :
#include<stdio.h>
#include<string.h>
struct point{
int x,y;
};
bool compare(char a,char b)
{
if(a>='A' && a<='Z'){
a=a+32;
}
if(b>='A' && b<='Z'){
b=b+32;
}
if ...
:roll:
I am getting WA in it.
Can Anyone give me some critical I/O Sets.?
Here Is My Code :
#include<stdio.h>
#include<string.h>
struct point{
int x,y;
};
bool compare(char a,char b)
{
if(a>='A' && a<='Z'){
a=a+32;
}
if(b>='A' && b<='Z'){
b=b+32;
}
if ...
- Wed Jan 10, 2007 8:49 pm
- Forum: Volume 100 (10000-10099)
- Topic: 10062 - Tell me the frequencies!
- Replies: 235
- Views: 69482
10062 P.E. -Solved

I've Submitted The Code again Using 'gets()' instead of 'scanf(" %[^\n]")',.......AND GOT Accepted ! '
- Wed Jan 10, 2007 7:45 pm
- Forum: Volume 100 (10000-10099)
- Topic: 10062 - Tell me the frequencies!
- Replies: 235
- Views: 69482
10062 P.E.,Help Plea...............se !
:roll:
Shouldn't There Be ANY '\n' After The last output line?
I'm getting P.E. With this code :
#include<stdio.h>
#include<string.h>
void main()
{
int freq[128],i,j,highest_freq,len,tag1=0,tag2;
char arr[1001];
while(scanf(" %[^\n]",arr)==1){
if(tag1==0) tag1=1;
else printf("\n");
len ...
Shouldn't There Be ANY '\n' After The last output line?
I'm getting P.E. With this code :
#include<stdio.h>
#include<string.h>
void main()
{
int freq[128],i,j,highest_freq,len,tag1=0,tag2;
char arr[1001];
while(scanf(" %[^\n]",arr)==1){
if(tag1==0) tag1=1;
else printf("\n");
len ...