### Saratov State University :: Online Contester

::Go
- home
- news
- register
 - update personal info
 - problemset archive
- submit
- status online
- standing
- contests
- virtual contests
- forum
- statistic
- FAQ
- links
- projects

 ::Poll Are you registered on Codeforces?YesNoWhat is it???[results]

::webboard

 Re: another problem having wrong judge
Author: SamiraG
ID: 055799
Problem: 121
Contest: 0
Date: 2014-12-28 15:19:19

I saw a code for problem 121 which was wrong but had got accepted:

test :
10
2 7 0
1 3 0
2 4 0
3 5 0
4 6 0
5 7 0
1 6 8 10 0
7 9 0
8 10 0
9 7 0

the code:
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

int n,p;
int g[110][110],c[110][110];
int d[110];

void dfs(int u,int col)
{
col=3-col;
for(int i=1; i<=d[u]; i++)
{
int v=g[u][i];
if(!c[u][v])
{
c[u][v]=col;
c[v][u]=col;
dfs(v,col);
col=3-col;
}
}
}

int main()
{
p=1;
for(int i=0;i<110;i++)
{
for(int j=0;j<110;j++)
{
g[i][j]=0;
c[i][j]=0;
}
d[i]=0;
}
int a;
scanf("%d",&n);
for(int i=1; i<=n; i++)
{
while(1)
{
scanf("%d",&a);
if(a==0)break;
d[i]++;
g[i][d[i]]=a;
}
}
for(int i=1; i<=n; i++)
{
if(d[i]&1)
{
dfs(i,1);
}
}
for(int i=1; i<=n; i++)
{
dfs(i,1);
}
for(int i=1; i<=n; i++)
{
if(d[i]>1)
{
int t=0;
for(int j=1; j<=d[i]; j++)
{
t|=(c[i][g[i][j]]);
}
if(t!=3)
{
printf("No solutionn");
break;
p=0;
}
}
}
if(p)
{
for(int i=1; i<=n; i++)
{
for(int j=1; j<=d[i]; j++)
{
printf("%d ",c[i][g[i][j]]);
}
printf("0n");
}
}
return 0;
}

 ::Login form.login input{margin:2px;font-size:10px;} your id: password: Forgot password?

 ::News 22.10.12 - The problems from the Southern Subregional Programming Contest 2012 added to the problemset archive (542 - 553). 22.10.12 - After the start of the contest the statements in PDF will be available by the link.23.10.11 - The problems from the Southern Subregional Programming Contest 2011 added to the problemset archive (530 - 541).

::Counter

 Server time: 2018-06-23 19:47:15 Online Contester Team © 2002 - 2016. All rights reserved.