Submission #3235294


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
//using pi = pair<int, int>;
const int MAXN = 1005;
const int MAXM = 200005;
 
vector<int> gph[MAXN];
int adj[MAXN][MAXN], vis[MAXN];
int n, m;
int s[MAXM], e[MAXM];
 
void dfs(int r, int v){
	vis[v] = 1;
	adj[r][v]++;
	int cnt=gph[v].size();
	for(int it=0;it<cnt;it++){
		int i=gph[v][it];
		if(i == r) continue;
		if(!vis[i] && adj[r][i] < 2){
			dfs(r, i);
		}
	}
}
 
int main(){
	cin >> n >> m;
	for(int i=0; i<m; i++){
		scanf("%d %d",&s[i],&e[i]);
		gph[s[i]].push_back(e[i]);
	}
	for(int i=1; i<=n; i++){
		int cnt=gph[i].size();
		for(int it=0;it<cnt;it++){
			int j=gph[i][it];
			if(adj[i][j] < 2){
				memset(vis, 0, sizeof(vis));
				dfs(i, j);
			}
		}
	}
	for(int i=1;i<=n;i++){
	    for(int j=1;j<=n;j++){
	        printf("%d ",adj[i][j]);
	    }
	    printf("\n");
	}
	for(int i=0; i<m; i++){
		if(adj[e[i]][s[i]] == 0){
			puts(adj[s[i]][e[i]] > 1 ? "diff" : "same");
		}
		else{
			puts(adj[s[i]][e[i]] > 1 ? "same" : "diff");
		}
	}
}

Submission Info

Submission Time
Task F - Two Faced Edges
User birchtree
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1053 Byte
Status WA
Exec Time 1086 ms
Memory 10112 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:28:29: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d",&s[i],&e[i]);
                             ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 1100
Status
WA × 3
WA × 55
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 WA 620 ms 9856 KB
bigcycle_1 WA 616 ms 9856 KB
dag_0 WA 314 ms 7936 KB
dag_1 WA 549 ms 9856 KB
dag_2 WA 357 ms 7936 KB
dag_3 WA 595 ms 9856 KB
dag_4 WA 504 ms 9344 KB
dag_5 WA 552 ms 9984 KB
dag_6 WA 494 ms 9088 KB
dag_7 WA 593 ms 9856 KB
dagex2_0 WA 523 ms 9472 KB
dagex2_1 WA 562 ms 9856 KB
dagex2_2 WA 542 ms 9472 KB
dagex2_3 WA 566 ms 9856 KB
dagex_0 WA 489 ms 9216 KB
dagex_1 WA 569 ms 9856 KB
dagex_2 WA 485 ms 9088 KB
dagex_3 WA 578 ms 9856 KB
example_0 WA 1 ms 256 KB
example_1 WA 1 ms 256 KB
example_2 WA 1 ms 256 KB
maxrand_0 WA 609 ms 9856 KB
maxrand_1 WA 607 ms 9856 KB
sep2_0 WA 619 ms 9856 KB
sep2_1 WA 618 ms 9856 KB
sep2ex_0 WA 489 ms 9984 KB
sep2ex_1 WA 492 ms 9984 KB
sep2ex_2 WA 617 ms 9856 KB
sep2ex_3 WA 638 ms 9856 KB
sep2ex_4 WA 826 ms 10112 KB
sep2ex_5 WA 804 ms 10112 KB
sep2ex_6 WA 1020 ms 9728 KB
sep2ex_7 WA 1023 ms 9856 KB
sep2ex_8 WA 1080 ms 9728 KB
sep2ex_9 WA 1086 ms 9728 KB
smallrand_0 WA 1 ms 384 KB
smallrand_1 WA 1 ms 384 KB
smallrand_2 WA 1 ms 256 KB
smallrand_3 WA 1 ms 256 KB
smallrand_4 WA 1 ms 256 KB
smallrand_5 WA 1 ms 384 KB
smallrand_6 WA 1 ms 256 KB
smallrand_7 WA 1 ms 384 KB
smallrand_8 WA 1 ms 256 KB
smallrand_9 WA 1 ms 384 KB
sparserand_0 WA 157 ms 6400 KB
sparserand_1 WA 157 ms 6400 KB
worst2_0 WA 135 ms 9088 KB
worst2_1 WA 143 ms 9216 KB
worst2_2 WA 134 ms 8960 KB
worst2_3 WA 142 ms 9088 KB
worst_0 WA 272 ms 10112 KB
worst_1 WA 326 ms 10112 KB
worst_2 WA 169 ms 9472 KB
worst_3 WA 207 ms 9472 KB