Re: Give me your code, and I will hepl you. My e-mail: marilyn_manson@bk.ru (-)
Sorry! i don't know why but my mail server has some troubles sending my message to you.Look what i got when i tried to send a message to you.
Hi. This is the qmail-send program at mail.rdslink.ro.
I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.
<marilyn_manson@bk.ru>:
194.67.23.20 does not like recipient.
Remote host said: 550 Access from ip address 193.231.236.20 blocked. Visit
http://win.mail.ru/cgi-bin/support_bl?ip=193.231.236.20Giving up on 194.67.23.20.
Here is what was writen in the mail:
Thanks for responding on the timus forum!Since a posted that topic i worked a lot on the source code, and generated a lot of special cases,and i found that i have one small bug which was generating an infinite cycle but i solved the problem.But i have a new one -> i send the very-tested source to timus and the evaluation system returned ACCES_VIOLATION.I know that this means that my program is trying to acces undeclared memory,but i really don't know how to solve this probelm beacuse i don't know where it occurs.I have the same bug on problem 1004 and i still haven' fixed it.In the attachment you have my source code.
10x for helping me! Marius Pungaru
And here is the source code(which doesn't works):
#include <stdio.h>
#include <string.h>
#define LMAX 100
#define NMAX 5002
struct Query
{
char parity;
long start, stop;
};
char str[LMAX];
struct Query Q[NMAX];
long range, q, i, j, nok, ok, step, N;
void swap(int l, int r)
{
struct Query aux;
aux = Q[l], Q[l] = Q[r], Q[r] = aux;
}
int main(void)
{
for (scanf("%ld", &range) ; range != -1 ; scanf("%ld", &range))
{
scanf("%ld\n", &N);
for (j = nok = 0 , q = -1 ; j < N && !nok ; j++)
{
q++, scanf("%ld %ld %s", &Q[q].start, &Q[q].stop, str);
Q[q].parity = strcmp(str, "even") ? 1 : 0;
/* binary search for the lowest element i with Q[i].start <= Q[q].start */
for (step = 1 ; step <= q + 1 ; step <<= 1) ;
for (i = q ; step ; step >>= 1)
if (i - step >= 0 && Q[i - step].start >= Q[q].start)
i -= step;
/* make reductions & stuff */
for ( ; (!nok) && i < q && Q[i].start == Q[q].start ; )
{
if (Q[i].stop == Q[q].stop)
nok = Q[i].parity == Q[q].parity ? 0 : 1, i = --q;
else
if (Q[i].stop < Q[q].stop)
Q[q].start = Q[i].stop + 1, Q[q].parity = Q[q].parity ^ Q[i].parity;
else swap(i, q);
for ( ; i < q && Q[i].start < Q[q].start ; i++) ;
}
/* bubble sort */
for (ok = 1 ; ok ; )
for (ok = 0, i = 1 ; i <= q ; i++)
if (Q[i - 1].start > Q[i].start)
ok = 1, swap(i - 1, i);
}
for (i = j , q++ ; i < N ; i++)
scanf("%ld %ld %s", Q[q].start, Q[q].stop, str);
printf("%ld\n", j - (nok ? 1 : 0));
}
return 0;
}
// Sorry for the long topic from above