Page 2 of 4
10050 still WA?
Posted: Fri Jan 28, 2005 7:01 pm
by Fuad Hassan_IIUC(DC)
i have changed a bit the initialization part but still WA
Posted: Fri Jan 28, 2005 7:23 pm
by Observer
Please do not open a new topic for posts concerning the same problem.
And you have completely mistaken my previous reply... By
initialization I mean setting the elements of your array count_a to 0. Check that statement, and hope you can get that fixed.
P.S. Remember to remove your code after you get AC.

Posted: Mon Jan 31, 2005 8:13 pm
by Fuad Hassan_IIUC(DC)
I don't understand what did you want to mean. plz describe it by pointing the specific line. thank you very much.

Posted: Tue Feb 01, 2005 2:54 pm
by Fuad Hassan_IIUC(DC)
thank you veeeeeeeeeeeeeery much i got AC

thank you again.
10050
Posted: Fri Jun 24, 2005 3:02 pm
by Salman
HI,
Getting WA for this code
[code]
/*
Name: Hartals
Number: 10050
Type : ad hoc
Process : ON
Author :Salman Zaman
Email :
zamansalman@gmail.com
Date : 02/06/05 01:27
*/
#include<stdio.h>
//#include<string.h>
//#include<conio.h>
int main(){
int n,p,t;
int days[4000];
int party[500];
int i,j,k,x,count;
//freopen("10050.txt","r",stdin);
scanf("%d",&t);
for(i=0;i<t;i++){
scanf("%d%d",&n,&p);
for(k=0;k<=n;k++)days[k]=0;
for(j=0;j<p;j++){
scanf("%d",&x);
for(k=x;k<=n;k=k+x){
days[k]=1;
}
}
for(k=7;k<=n;k+=7){
days[k]=0;
days[k-1]=0;
}
for(k=1,count=0;k<=n;k++){
if(days[k])count++;
}
printf("%d\n",count);
}
// getch();
return 0;
}
[/code]
Test case is ok but i think the problem is with weekends checking!!!
Posted: Sun Jun 26, 2005 12:27 pm
by J&Jewel
U used a array party that is never used.... & try for these inputs:
Input:
4
8
100
4
12
15
25
40
1000
4
45
100
6
12
3000
10
15
500
6
89
87
184
456
15
444
2
My Acc program Output:
5
15
132
1166
Your:
5
15
133
1166
So may be u have done some mistake ....Try urself ...best..to find out it...
test cases
Posted: Mon Jun 27, 2005 8:52 am
by Sedefcho
J & Jewel,
I'm affraid your
input is slightly wrong
( does dot match the input description from
the problem statement ).
Here are your test cases
corrected plus
one more test case.
INPUT
Code: Select all
5
14
3
3
4
8
100
4
12
15
25
40
1000
4
45
100
6
12
3000
10
15
500
6
89
87
184
456
15
444
2
3600
10
9
12
17
100
121
130
200
3600
3601
181
OUTPUT
I hope the test cases will be helpful to
Salman and/or to someone else.
Posted: Tue Jun 28, 2005 6:54 am
by J&Jewel
Sorry salman and thanks to sadefcho ...may be 4 copy paste problem happends....
10050 - Hartals - I got RE.
Posted: Tue Apr 11, 2006 6:05 am
by mosaick2
I don't know what make my program runtime error.
Actually, when I tested my program, it was no problem.
Who can advise me?
Code: Select all
#include <iostream>
#include <cstring>
using namespace std;
const int MAXPARTY = 110;
const int MAXDAY = 3700;
const int SAT = 7;
int main()
{
int tscase;
cin >> tscase;
int days, partis;
bool day[MAXDAY] = {false,};
int party[MAXPARTY] = {0,};
for(int i=0; i < tscase; i++)
{
// Input
cin >> days >> partis;
for(int j=0; j < partis; j++)
{
cin >> party[j];
}
// Processing
for(int k=1; k <= days; k++)
{
for(int m=0; m < partis; m++)
{
if( (k % party[m]) == 0 ) {
day[k] = true;
}
}
}
int count = 0;
for(int k=1; k <= days; k++)
{
if( (day[k] == true) ) {
if( (k % SAT) != 0 && (k % SAT) != 6) {
count++;
}
}
}
// Output
if( i == tscase-1 )
cout << count;
else
cout << count << endl;
// Clear
memset(day, 0x00, sizeof(int)*days);
memset(party, 0x00, sizeof(int)*partis);
}
return 0;
}
Re: 10050 - Hartals - I got RE.
Posted: Wed Apr 12, 2006 12:38 pm
by mosaick2
I got A.C.
But, I have just changed my Clear part.
I used for-loop to clear array instead of memset function.
I can't understand why the memset function occur Runtime error.
Who can explain me about it?
Re: 10050 - Hartals - I got RE.
Posted: Wed Apr 12, 2006 1:21 pm
by kryptolus
mosaick2 wrote:I got A.C.
But, I have just changed my Clear part.
I used for-loop to clear array instead of memset function.
I can't understand why the memset function occur Runtime error.
Who can explain me about it?
You define 'day' as an array of bools yet you use sizeof(int) instead of sizeof(bool) when you specify the size of the array in memset. 'bool' is defined as a char so you are clearing data after the end of your array.
Re: 10050 - Hartals - I got RE.
Posted: Thu Apr 13, 2006 5:35 am
by mosaick2
kryptolus wrote:mosaick2 wrote:I got A.C.
But, I have just changed my Clear part.
I used for-loop to clear array instead of memset function.
I can't understand why the memset function occur Runtime error.
Who can explain me about it?
You define 'day' as an array of bools yet you use sizeof(int) instead of sizeof(bool) when you specify the size of the array in memset. 'bool' is defined as a char so you are clearing data after the end of your array.
Oh, my GOD...
Thanks, kruptolus.
I'm really appreciate you.
why runtime error hartals:10050?
Posted: Sun Nov 19, 2006 11:15 am
by newton
deleted after acceptation
thank you to help me.
Re: why runtime error hartals:10050?
Posted: Mon Nov 20, 2006 10:32 am
by tan_Yui
newton wrote:may you check it please?
both of c and c++ compiler told me runtime error.
but why?
array[1000] -> array[3651]
day[3651] -> day[100]
After getting correct answer, please delete above your code.
Best regards.
What am I doing wrong?
Posted: Thu Aug 16, 2007 12:07 am
by Ion2Atom
I have tried my program with all the sample input from the four threads on Hartals and it works perfectly for all of them. What am I missing? Thanks in advance.