Something wrong on testcase 6.
Posted by
qwe 10 May 2004 19:24
please check it. AC'ers try to submit your solution one more time. If its OK, then sorry(i'm stupid).
Re: Why do you think so?
Posted by
qwe 11 May 2004 14:45
First i got WA #6
I have counted the number of edges. in program is that code:
If count=6 then while true do;
TL#6
I changed to :
If count=6 then begin writeln(1); halt; end;
WA#6
Than:
If count=6 then begib writeln(0); halt; end;
WA#6...
It's something strange, because output maybe only 1 or 0...
All is ok with test #6, the answer belongs to set {0,1}.
Re: All is ok with test #6, the answer belongs to set {0,1}.
Posted by
qwe 11 May 2004 21:10
No. I'm sure. Please submit your solution ad you'll see.
I saw the output for test #6. You try to submit once again.
Re: I saw the output for test #6. You try to submit once again.
Posted by
qwe 11 May 2004 23:05
WA#6...
Re: I saw the output for test #6. You try to submit once again.
I also get WA on test #6. Please tell me if you get AC.
Re: I saw the output for test #6. You try to submit once again.
Posted by
Fenriz 11 May 2004 23:50
I also get WA on test #6.
me too =(
Edited by author 11.05.2004 23:50The answer for test #6 is 0, you may check this.
Re: The answer for test #6 is 0, you may check this.
Posted by
Fenriz 12 May 2004 17:07
WA#6...
It means that your program is wrong.
Re: It means that your program is wrong.
Posted by
qwe 13 May 2004 00:12
NO! Just submit your solution and you'll see i'm right!
Re: OK, see this...
Posted by
qwe 13 May 2004 01:12
OK, but how...
if count=6 then
begin
while true do;
halt;
end;
TL;
if count=6 then
begin
writeln(0);
halt;
end;
WA
if count=6 then
begin
writeln(1);
halt;
end;
WA
Is it possible?
Re: OK, see this...
Posted by
qwe 13 May 2004 12:43
hm... accept... i just changed eof to seekoef. But why? Who can explain me?
What's the difference?!
Thank you very much!
I also got accepted just changing eof on seekeof.
But what is the difference?
Edited by author 13.05.2004 19:36
Edited by author 13.05.2004 19:37
There is a diffirence...
There may be a following situation. A line break (eoln) ends the last line of input and your program read last number with "read" function, so only a number is removed from the input stream, but the eoln symbol is still in stream. At this moment "eof" function returns false (it sees eoln symbol, so it is not end of file), but "seekeof" returns true (it skips all whitespace in a stream including eoln symbol).
Re: There is a diffirence...
Thank you very much!
Can someone help me? I have WA 6...
Posted by
Denis 9 Dec 2007 04:07
#include <fstream>
#include <stdio.h>
using namespace std;
int n, nm = 0;
int arr[1010][1010] = {0};
int mark[1010] = {0};
int col[1010] = {0};
void dfs (int v)
{
mark[v] = nm;
int i;
for (i = 1; i <= n; ++i)
{
if (mark[i] == 0 && arr[v][i] == 1)
{
dfs (i);
}
}
}
int main ()
{
//freopen ("a.in", "r", stdin);
//freopen ("a.out", "w", stdout);
int i, a, b;
n = 0;
while (scanf("%d%d", &a, &b) == 2)
{
arr[a][b] = 1;
arr[b][a] = 1;
if (a < b)
{
swap (a, b);
}
if (n < a)
{
n = a;
}
}
for (i = 1; i <= n; ++i)
{
if (mark[i] == 0)
{
++nm;
dfs (i);
}
}
for (i = 1; i <= n; ++i)
{
++col[mark[i]];
}
for (i = 1; i <= nm; ++i)
{
if (col[i] == 2)
{
printf ("0\n");
return 0;
}
}
printf ("1\n");
return 0;
}