Submission #3231441


Source Code Expand

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
inline void read(int &x)
{
	x=0;int f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	x*=f;
}
struct node{
	int nex,to,from;
}edge[200005];
int N,M;
int head[1005],tot;
inline void insert(int from,int to)
{
	edge[++tot].nex=head[from];
	head[from]=tot;
	edge[tot].to=to;
	edge[tot].from=from;
}
int mex[1005][1005];
bool vis[1005];
void dfs(int v,int x)
{
	vis[x]=1;
	for(int i=head[x];i;i=edge[i].nex)
		if(!vis[edge[i].to]&&mex[v][edge[i].to]<=2)
		{
			mex[v][edge[i].to]++;
			dfs(v,edge[i].to);
		}
	vis[x]=0;
	 
}
int main()
{
	read(N);read(M);
	int u,v;
	for(int i=1;i<=M;i++)
	{
		read(u);read(v);
		insert(u,v);
	} 
	for(int i=1;i<=N;i++)
		dfs(i,i);
	/*for(int i=1;i<=N;i++)
	{
		for(int j=1;j<=N;j++)
			cout<<mex[i][j]<<" ";
		cout<<endl;
	}*/
	for(int i=1;i<=M;i++)
	{
		bool flag=0;
		if(mex[edge[i].from][edge[i].to]&&mex[edge[i].to][edge[i].from])
			if(mex[edge[i].from][edge[i].to]<2)
				flag=1;
		if(!mex[edge[i].to][edge[i].from]&&mex[edge[i].from][edge[i].to]>=2)
			flag=1;
		if(flag)
			printf("diff\n");
		else
			printf("same\n");
	}
		
}

Submission Info

Submission Time
Task F - Two Faced Edges
User vjudge2
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1222 Byte
Status WA
Exec Time 5255 ms
Memory 7552 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 1100
Status
AC × 3
AC × 13
WA × 32
TLE × 10
Set Name Test Cases
Sample example_0, example_1, example_2
All bigcycle_0, bigcycle_1, dag_0, dag_1, dag_2, dag_3, dag_4, dag_5, dag_6, dag_7, dagex2_0, dagex2_1, dagex2_2, dagex2_3, dagex_0, dagex_1, dagex_2, dagex_3, example_0, example_1, example_2, maxrand_0, maxrand_1, sep2_0, sep2_1, sep2ex_0, sep2ex_1, sep2ex_2, sep2ex_3, sep2ex_4, sep2ex_5, sep2ex_6, sep2ex_7, sep2ex_8, sep2ex_9, smallrand_0, smallrand_1, smallrand_2, smallrand_3, smallrand_4, smallrand_5, smallrand_6, smallrand_7, smallrand_8, smallrand_9, sparserand_0, sparserand_1, worst2_0, worst2_1, worst2_2, worst2_3, worst_0, worst_1, worst_2, worst_3
Case Name Status Exec Time Memory
bigcycle_0 TLE 5255 ms 6528 KB
bigcycle_1 TLE 5255 ms 6528 KB
dag_0 AC 976 ms 6784 KB
dag_1 AC 2237 ms 7552 KB
dag_2 WA 2779 ms 6784 KB
dag_3 TLE 5255 ms 6528 KB
dag_4 AC 1972 ms 7296 KB
dag_5 AC 2231 ms 7552 KB
dag_6 WA 4773 ms 7168 KB
dag_7 TLE 5255 ms 6528 KB
dagex2_0 WA 1997 ms 7296 KB
dagex2_1 WA 2209 ms 7552 KB
dagex2_2 WA 2020 ms 7296 KB
dagex2_3 WA 2189 ms 7552 KB
dagex_0 WA 1890 ms 7168 KB
dagex_1 WA 2208 ms 7552 KB
dagex_2 WA 1697 ms 7168 KB
dagex_3 WA 2189 ms 7552 KB
example_0 AC 1 ms 2304 KB
example_1 AC 1 ms 2304 KB
example_2 AC 1 ms 2304 KB
maxrand_0 TLE 5255 ms 6528 KB
maxrand_1 TLE 5255 ms 6528 KB
sep2_0 TLE 5255 ms 6528 KB
sep2_1 TLE 5255 ms 6528 KB
sep2ex_0 WA 3725 ms 7552 KB
sep2ex_1 WA 3802 ms 7552 KB
sep2ex_2 WA 3307 ms 7552 KB
sep2ex_3 WA 3309 ms 7552 KB
sep2ex_4 WA 3894 ms 7552 KB
sep2ex_5 WA 3835 ms 7552 KB
sep2ex_6 WA 4546 ms 7552 KB
sep2ex_7 WA 4622 ms 7552 KB
sep2ex_8 TLE 5255 ms 6528 KB
sep2ex_9 TLE 5255 ms 6528 KB
smallrand_0 WA 1 ms 2304 KB
smallrand_1 WA 1 ms 2304 KB
smallrand_2 AC 1 ms 2304 KB
smallrand_3 AC 1 ms 2304 KB
smallrand_4 WA 1 ms 2304 KB
smallrand_5 WA 1 ms 2304 KB
smallrand_6 AC 1 ms 2304 KB
smallrand_7 WA 1 ms 2304 KB
smallrand_8 AC 1 ms 2304 KB
smallrand_9 WA 1 ms 2304 KB
sparserand_0 WA 223 ms 4480 KB
sparserand_1 WA 224 ms 4480 KB
worst2_0 AC 23 ms 6528 KB
worst2_1 WA 270 ms 6784 KB
worst2_2 AC 23 ms 6784 KB
worst2_3 WA 203 ms 6912 KB
worst_0 WA 2227 ms 7296 KB
worst_1 WA 2528 ms 7424 KB
worst_2 WA 679 ms 7168 KB
worst_3 WA 967 ms 7168 KB