i am getting WA..any special I/0
#include<stdio.h>
#define MAX 105
#define INFINITY 10000000
int cost[MAX][MAX];
int len[MAX];
bool intree[MAX];
int n,m;
void ini(){
for(int i=0;i<n;i++){
intree[i]=false;
len[i]=0;
}
}
void update(int v){
for(int i=0;i<n;i++){
if(cost[v][i]!=0 && len[i]<cost ...
Search found 25 matches
- Sat Dec 19, 2009 6:03 pm
- Forum: Volume 108 (10800-10899)
- Topic: 10842 - Traffic Flow
- Replies: 17
- Views: 13451
- Sat Dec 19, 2009 7:25 am
- Forum: Volume 117 (11700-11799)
- Topic: 11730 - Number Transformation
- Replies: 7
- Views: 5134
Re: 11730 - Number Transformation
my ac program gives:
Case 1: 2
Case 2: -1
Case 3: 4
Case 4: 3
Case 5: 1
Case 6: 1
Case 7: 2
Case 8: 3
Case 9: 3
Case 10: 3
Case 11: 1
Case 12: 0
Case 13: 3
Case 14: 4
Case 15: 2
Case 16: 13
Case 17: 15
Case 18: 16
Case 19: 16
Case 20: 1
Case 21: 1
Case 22: -1
Case 23: 1
Case 24: 3
what is the ...
Case 1: 2
Case 2: -1
Case 3: 4
Case 4: 3
Case 5: 1
Case 6: 1
Case 7: 2
Case 8: 3
Case 9: 3
Case 10: 3
Case 11: 1
Case 12: 0
Case 13: 3
Case 14: 4
Case 15: 2
Case 16: 13
Case 17: 15
Case 18: 16
Case 19: 16
Case 20: 1
Case 21: 1
Case 22: -1
Case 23: 1
Case 24: 3
what is the ...
- Sun Nov 08, 2009 4:21 pm
- Forum: Volume 6 (600-699)
- Topic: 657 - The die is cast
- Replies: 46
- Views: 30558
Re: 657 - The die is cast
why WA??
#include<stdio.h>
#include<queue>
#include<algorithm>
#define MAX 60
using namespace std;
queue<int>row;
queue<int>column;
queue<int>r;
queue<int>c;
char path[MAX][MAX];
int fg[MAX][MAX];
int n,m;
int rw[5]={0,-1,1,0,0};
int col[5]={0,0,0,-1,1};
int ans[MAX];
void play(int u,int v){
int ...
#include<stdio.h>
#include<queue>
#include<algorithm>
#define MAX 60
using namespace std;
queue<int>row;
queue<int>column;
queue<int>r;
queue<int>c;
char path[MAX][MAX];
int fg[MAX][MAX];
int n,m;
int rw[5]={0,-1,1,0,0};
int col[5]={0,0,0,-1,1};
int ans[MAX];
void play(int u,int v){
int ...
- Fri Oct 23, 2009 8:15 am
- Forum: Volume 102 (10200-10299)
- Topic: 10200 - Prime Time
- Replies: 202
- Views: 97043
Re: 10200 - Prime Time
I am getting WA from the judge..all the test cases given in this forum matches with my output..please point out the mistake.
#include<stdio.h>
#include<math.h>
#define MAX 1000000
bool pr[MAX];
int pri[80000];
void sieve(){
int ns=0;
int sq;
sq=sqrt(MAX);
pr[0]=true;
pr[1]=true;
pri[ns++]=2 ...
#include<stdio.h>
#include<math.h>
#define MAX 1000000
bool pr[MAX];
int pri[80000];
void sieve(){
int ns=0;
int sq;
sq=sqrt(MAX);
pr[0]=true;
pr[1]=true;
pri[ns++]=2 ...
- Mon Sep 28, 2009 7:58 am
- Forum: Volume 100 (10000-10099)
- Topic: 10004 - Bicoloring
- Replies: 93
- Views: 45526
Re: 10004 - Bicoloring
I am getting WA in this problem....please help
#include<stdio.h>
#include<queue>
#define MAX 201
using namespace std;
queue<int>ans;
int n,e;
int path[MAX][MAX];
int col[MAX];
void ini(){
for(int i=0;i<MAX;i++){
for(int j=0;j<MAX;j++)
path[i][j]=0;
col[i]=0;
}
}
int bfs(int u){
int ...
#include<stdio.h>
#include<queue>
#define MAX 201
using namespace std;
queue<int>ans;
int n,e;
int path[MAX][MAX];
int col[MAX];
void ini(){
for(int i=0;i<MAX;i++){
for(int j=0;j<MAX;j++)
path[i][j]=0;
col[i]=0;
}
}
int bfs(int u){
int ...
- Sun Sep 20, 2009 1:31 pm
- Forum: Volume 4 (400-499)
- Topic: 483 - Word Scramble
- Replies: 122
- Views: 39167
Re: 483
I am getting WA for the following code
#include<stdio.h>
#include<string.h>
char in[10000000],rev[10000000];
int ns,len,n,x;
int main(){
// freopen("483.txt","r",stdin);
while(gets(in)){
len=strlen(in);
for(int i=0;i<len;i++){
while(in[i]!=' ' && in[i]!='\0' ){
rev[ns++]=in[i];
i ...
#include<stdio.h>
#include<string.h>
char in[10000000],rev[10000000];
int ns,len,n,x;
int main(){
// freopen("483.txt","r",stdin);
while(gets(in)){
len=strlen(in);
for(int i=0;i<len;i++){
while(in[i]!=' ' && in[i]!='\0' ){
rev[ns++]=in[i];
i ...
- Thu Sep 17, 2009 5:14 pm
- Forum: Volume 4 (400-499)
- Topic: 490 - Rotating Sentences
- Replies: 212
- Views: 48455
Re: 490 - Rotating Sentences
Thank You.....I got AC 

- Mon Aug 31, 2009 9:20 am
- Forum: Volume 3 (300-399)
- Topic: 355 - The Bases Are Loaded
- Replies: 74
- Views: 30655
Re: 355 - The Bases Are Loaded
I am getting WA for this problem.....i tried all the test cases given ......
#include<stdio.h>
#include<math.h>
#include<string.h>
int main(){
// freopen("355.txt","r",stdin);
int c,b,n,len,x,fg,temp;
long long ns;
char in[12],base[20];
char ans[]={'0','1','2','3','4','5','6','7','8','9','A ...
#include<stdio.h>
#include<math.h>
#include<string.h>
int main(){
// freopen("355.txt","r",stdin);
int c,b,n,len,x,fg,temp;
long long ns;
char in[12],base[20];
char ans[]={'0','1','2','3','4','5','6','7','8','9','A ...
- Mon Aug 10, 2009 10:12 pm
- Forum: Volume 102 (10200-10299)
- Topic: 10221 - Satellites
- Replies: 34
- Views: 20466
Re: 10221 - Satellites
why wrong answer
#include<stdio.h>
#include<math.h>
#include<string.h>
#define pi 3.1415926535897932384626433832795
int main()
{
//freopen("10221.txt","r",stdin);
int s;
char a[10];
long double ans,temp,len,ac,deg;
while((scanf("%d %Lf %s",&s,°,&a)==3)){
if(!strcmp(a,"min"))
ans=deg ...
#include<stdio.h>
#include<math.h>
#include<string.h>
#define pi 3.1415926535897932384626433832795
int main()
{
//freopen("10221.txt","r",stdin);
int s;
char a[10];
long double ans,temp,len,ac,deg;
while((scanf("%d %Lf %s",&s,°,&a)==3)){
if(!strcmp(a,"min"))
ans=deg ...
- Mon Aug 10, 2009 7:50 pm
- Forum: Volume 4 (400-499)
- Topic: 490 - Rotating Sentences
- Replies: 212
- Views: 48455
Re: 490 - Rotating Sentences
Code: Select all
removed after AC
- Thu Aug 06, 2009 5:28 am
- Forum: Volume 102 (10200-10299)
- Topic: 10235 - Simply Emirp
- Replies: 150
- Views: 51529
Re: 10235 - Simply Emirp
Can anyone point out the mistake in my program...
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define max 1000000
bool pr[max+1];
int prime[max];
int main()
{
long int ns,re;
int len,r,fg;
char in[10],rev[10];
//generating primes
pr[0]=true;
pr[1]=true;
for(int i=2;i*i ...
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define max 1000000
bool pr[max+1];
int prime[max];
int main()
{
long int ns,re;
int len,r,fg;
char in[10],rev[10];
//generating primes
pr[0]=true;
pr[1]=true;
for(int i=2;i*i ...
- Wed Aug 05, 2009 10:26 am
- Forum: Volume 5 (500-599)
- Topic: 583 - Prime Factors
- Replies: 171
- Views: 61573
Re: 583 - Prime Factors
I am getting TLE .....plz help
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main()
{
//freopen("583.txt","r",stdin);
long int in,ans[100],ns,temp,t,r;
while((scanf("%d",&in)==1))
{
if(in==0)
exit(0);
t=0;
ns=0;
r=in;
printf("%ld = ",r);
if(in<0)
{
in=-in;
printf("%d ...
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main()
{
//freopen("583.txt","r",stdin);
long int in,ans[100],ns,temp,t,r;
while((scanf("%d",&in)==1))
{
if(in==0)
exit(0);
t=0;
ns=0;
r=in;
printf("%ld = ",r);
if(in<0)
{
in=-in;
printf("%d ...
- Wed Jul 29, 2009 9:12 pm
- Forum: Volume 109 (10900-10999)
- Topic: 10922 - 2 the 9s
- Replies: 38
- Views: 21199
Re: 10922 - 2 the 9s
please identify the mistake in my code..........is there any critical input??
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
//freopen("10922.txt","r",stdin);
char in[1500],c[1];
int ans,ns,temp,t;
while(gets(in))
{
if(in[0]=='0'&&strlen(in)==1)
exit(0);
ans=0 ...
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
//freopen("10922.txt","r",stdin);
char in[1500],c[1];
int ans,ns,temp,t;
while(gets(in))
{
if(in[0]=='0'&&strlen(in)==1)
exit(0);
ans=0 ...
- Wed Jul 01, 2009 7:08 am
- Forum: Volume 103 (10300-10399)
- Topic: 10347 - Medians
- Replies: 32
- Views: 17995
Re: 10347 - Medians
i got AC thkns.....but what was the problem with long double??
- Tue Jun 30, 2009 12:49 pm
- Forum: Volume 103 (10300-10399)
- Topic: 10347 - Medians
- Replies: 32
- Views: 17995
Re: 10347 - Medians
i got a formula on the internet which helps to calculate the area of the triangle using three median. it is
1/3(sqrt(2(u^2v^2+u^2w^2+v^2w^2)-(u^4+v^4+w^4))
where u,v,w are the median of the triangle. using this i wrote the program...i got correct results for several test cases posted in this forum ...
1/3(sqrt(2(u^2v^2+u^2w^2+v^2w^2)-(u^4+v^4+w^4))
where u,v,w are the median of the triangle. using this i wrote the program...i got correct results for several test cases posted in this forum ...