## 700 - Date Bugs

Moderator: Board moderators

bigredteam1994
New poster
Posts: 2
Joined: Fri Dec 14, 2001 2:00 am

### 700 - Date Bugs

Code: Select all

``````//@begin_of_source_code
/* @JUDGE_ID: 15976FM 700 C++ */
#include<iostream.h>

int main()
{
int l;
int i,temp, max,k;
int A ;
int n,a,b;
bool solved, done;

int D;
cin>>n;
//cout << "n" << n << endl;
k=1;
while( n!= 0){
for( i=1; i <=n; i++)
{
cin>>A[i]>>a>>b;
D[i] = b - a;
//cout << "i" << i << "A[i]" << A[i]
//     << "D[i]" << D[i] <<endl;
}
done = false;
solved =false;
l=1;
while(!done)
{
max = 0;
//cout << "max" << max << endl;
for(i =1; i <= n; i++)
{
if( A[i] > max )
max = A[i];

}
for(i =1; i <= n; i++)
{
while( (l==1) || A[i] < max )
{
//cout << "updating ";
//cout << " A[i] "
//     <<endl;
A[i] = A[i] + D[i];
if ( A[i] >= max)
max = A[i];
l++;
}
//cout << "i" << i << "A[i]" << A[i]   << endl;
//cout << "max" << max << endl;

}
solved = true;
temp = A;
//	cout<< "I am Here "<<endl;
for( i = 2; i <= n; i++)
{
if(A[i] != temp)
solved = false;
}
//cout<<solved <<endl;
if(!solved)
{
done = false;
for(i = 1; i<= n; i++){
if( A[i] >= 10000)
done = true;

}
}
else
done = true;
//	cout<<done<<endl;
l++;
//if(l>88)
//	done = true;

}
cout << "Case #" << k << ':' << endl;
if(solved)
cout << "The actual year is " << A <<'.'
<<endl;
else
cout << "Unknown bugs detected." << endl;
cin>>n;
//cout<<"n"<<n<<endl;
k++;
if( n != 0)
cout<<endl;
}
return 0;
}

//@end_of_source_code``````

TheRock
New poster
Posts: 1
Joined: Tue Nov 19, 2002 8:33 pm

### 700 - WA ? Pl. tell me ?

This is the code i wrote

Code: Select all

``````#include <iostream.h>
#include <vector>
#include <stdio.h>

void main()
{
int cnt = 0;
while (1)
{
int n;
cin>>n;
if (n == 0) break;
vector <int> a,b,y;
for (int i=0;i<n;i++)
{
int ai,bi,yi;
cin>>yi>>ai>>bi;
a.push_back(ai);
b.push_back(bi);
y.push_back(yi);
}
int max = -1;
for (int i=0;i<n;i++)
if (max == -1 || y[max] < y[i])
max = i;
bool change = true,conv=true;
while (change)
{
int nmax=max;
change = false;
for (int i=0;i<n;i++)
if (y[max] != y[i])
{
change = true;
y[i] += (b[i] - a[i]);
if (y[i] > y[nmax]) nmax = i;
}
if (y[nmax] > 10000) {
conv = false;
break;
}
max = nmax;
}
if (cnt != 0) cout<<endl<<endl;
cnt++;
cout<<"Case #"<<cnt<<":"<<endl;
if (conv)
{
cout<<"The actual year is "<<y<<".";
}
else
{
cout<<"Unknown bugs detected.";
}

}
}``````

ei01036
New poster
Posts: 12
Joined: Wed Jan 15, 2003 1:13 am
I'm getting WA in this problem all the time... Does someone have some special test cases? My program works for all i've remembered! Thank you

cyfra
Experienced poster
Posts: 144
Joined: Thu Nov 22, 2001 2:00 am
Location: Gdynia, Poland
Look carefully at the limits That was my bug...

Hope it will help

Good Luck minskcity
Experienced poster
Posts: 199
Joined: Tue May 14, 2002 10:23 am
Location: Vancouver
Can anybody post some test cases for this problem (#700) ?

especially interested in those tests that will cause wrong answer for following code:

Code: Select all

``````#include <iostream.h>
int	n;
int	data;

int	get_the_date(){
int	min = 100000;
int	max = 0;
int	out = 0;
for(int	i = 0; i < n; i++){
if(data[i] < min)	min = data[i];
if(data[i] > max)	max = data[i];
}
out = max;
while(out < 10000){
for(int	i = 0; i < n; i++)
while(data[i] < max)
data[i] = data[i] - data[i] + data[i];
min = 100000;
max = 0;
for(int	i = 0; i < n; i++){
if(data[i] < min)	min = data[i];
if(data[i] > max)	max = data[i];
}
out = max;
if(max == min)	break;
}
return	out;
}

int main(){
int	count = 0;
while(cin >> n){
count++;
if(n == 0)	break;
for(int	i = 0; i < n; i++)	cin >> data[i] >> data[i] >> data[i];
cout << "Case #" << count << ":\n" << "The actual year is " << answer << ".\n";
}	else	cout << "Unknown bugs detected.\n";
cout << endl;
}
return	0;
}``````

neowarez
New poster
Posts: 14
Joined: Tue May 06, 2003 11:04 pm
Location: Portugal
Contact:

### Same problem

I am having the same problem.. can someone post some input and output so I can test my problem?

Thanks.
Neo

daveon
Experienced poster
Posts: 229
Joined: Tue Aug 31, 2004 2:41 am
Hi there,

Here's some IO I've found.

INPUT:

Code: Select all

``````2
1941 1900 2000
2005 1904 2040
2
1998 1900 2000
1999 1900 2000
1
1938 1900 2000
1
1938 1900 2100
1
12 11 22
4
1 0 3
0 0 5
2 0 7
1 0 11
2
132 100 200
135 100 200
5
101 100 200
101 100 201
101 100 202
101 100 203
101 100 204
5
101 100 200
101 100 201
100 100 202
101 100 203
101 100 204
2
1998 1000 2000
1935 1930 1941
2
1999 1000 2000
1936 1930 1941
2
1000 1000 2000
1937 1930 1941
1
0 0 1
20
2 2 3
31 31 32
3 3 4
37 37 38
5 5 6
41 41 42
7 7 8
43 43 44
11 11 12
47 47 48
13 13 14
53 53 54
71 71 72
17 17 18
59 59 60
19 19 20
61 61 62
23 23 24
67 67 68
29 29 30
3
9 1 10
0 0 11
0 0 101
10
1942 1900 2000
1942 1900 2000
1942 1900 2000
1942 1900 2000
1942 1900 2000
1942 1900 2000
1942 1900 2000
1942 1900 2000
1942 1900 2000
1942 1900 2000
2
1240 1234 1244
1913 1900 2001
1
2000 0 9999
2
0 0 9999
1492 1492 1493
2
1 0 9999
1492 1492 1493
0
``````
OUTPUT:

Code: Select all

``````Case #1:
The actual year is 2141.

Case #2:
Unknown bugs detected.

Case #3:
The actual year is 1938.

Case #4:
The actual year is 1938.

Case #5:
The actual year is 12.

Case #6:
The actual year is 100.

Case #7:
Unknown bugs detected.

Case #8:
The actual year is 101.

Case #9:
Unknown bugs detected.

Case #10:
The actual year is 9998.

Case #11:
The actual year is 9999.

Case #12:
Unknown bugs detected.

Case #13:
The actual year is 0.

Case #14:
The actual year is 71.

Case #15:
The actual year is 9999.

Case #16:
The actual year is 1942.

Case #17:
The actual year is 2620.

Case #18:
The actual year is 2000.

Case #19:
The actual year is 9999.

Case #20:
Unknown bugs detected.

``````

aksam
New poster
Posts: 1
Joined: Sun Nov 22, 2015 8:49 pm

### Re: 700 - Date Bugs

My solution for the same problem in poj.org is passing http://poj.org/problem?id=1044.
But Here I am getting wrong answer which test cases I am missing?