답안 #744636

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
744636 2023-05-18T21:20:19 Z MohamedAhmed04 Kutije (COCI21_kutije) C++14
35 / 70
1000 ms 17884 KB
#include <bits/stdc++.h>

using namespace std ;

const int MAX = 1000 + 10 ;

int arr[MAX] ;
int n , m , q ;

vector< vector<int> >adj(MAX) ;

int vis[MAX][MAX] ;
int src ;

void dfs(int node)
{
	vis[src][node] = 1 ;
	for(auto &child : adj[node])
	{
		if(!vis[src][child])
			dfs(child) ;
	}
}

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>n>>m>>q ;
	for(int i = 1 ; i <= m ; ++i)
	{
		for(int i = 1 ; i <= n ; ++i)
		{
			int x ;
			cin>>x ;
			adj[x].push_back(i) ;
		}
	}
	for(int i = 1 ; i <= n ; ++i)
		src = i , dfs(i) ;
	while(q--)
	{
		int x , y ;
		cin>>x>>y ;
		if(vis[x][y])
			cout<<"DA\n" ;
		else
			cout<<"NE\n" ;
	}
	return 0 ;
}		
# 결과 실행 시간 메모리 Grader output
1 Correct 102 ms 9584 KB Output is correct
2 Correct 104 ms 8680 KB Output is correct
3 Correct 85 ms 8264 KB Output is correct
4 Correct 108 ms 9648 KB Output is correct
5 Correct 111 ms 9580 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 852 KB Output is correct
2 Correct 1 ms 852 KB Output is correct
3 Correct 2 ms 724 KB Output is correct
4 Correct 2 ms 724 KB Output is correct
5 Correct 1 ms 724 KB Output is correct
6 Correct 1 ms 748 KB Output is correct
7 Correct 3 ms 836 KB Output is correct
8 Correct 1 ms 752 KB Output is correct
9 Correct 2 ms 852 KB Output is correct
10 Correct 1 ms 852 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 852 KB Output is correct
2 Correct 1 ms 852 KB Output is correct
3 Correct 2 ms 724 KB Output is correct
4 Correct 2 ms 724 KB Output is correct
5 Correct 1 ms 724 KB Output is correct
6 Correct 1 ms 748 KB Output is correct
7 Correct 3 ms 836 KB Output is correct
8 Correct 1 ms 752 KB Output is correct
9 Correct 2 ms 852 KB Output is correct
10 Correct 1 ms 852 KB Output is correct
11 Correct 2 ms 796 KB Output is correct
12 Correct 1 ms 852 KB Output is correct
13 Correct 2 ms 752 KB Output is correct
14 Correct 2 ms 724 KB Output is correct
15 Correct 1 ms 724 KB Output is correct
16 Correct 1 ms 724 KB Output is correct
17 Correct 2 ms 852 KB Output is correct
18 Correct 1 ms 852 KB Output is correct
19 Correct 2 ms 852 KB Output is correct
20 Correct 2 ms 724 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 102 ms 9584 KB Output is correct
2 Correct 104 ms 8680 KB Output is correct
3 Correct 85 ms 8264 KB Output is correct
4 Correct 108 ms 9648 KB Output is correct
5 Correct 111 ms 9580 KB Output is correct
6 Correct 1 ms 852 KB Output is correct
7 Correct 1 ms 852 KB Output is correct
8 Correct 2 ms 724 KB Output is correct
9 Correct 2 ms 724 KB Output is correct
10 Correct 1 ms 724 KB Output is correct
11 Correct 1 ms 748 KB Output is correct
12 Correct 3 ms 836 KB Output is correct
13 Correct 1 ms 752 KB Output is correct
14 Correct 2 ms 852 KB Output is correct
15 Correct 1 ms 852 KB Output is correct
16 Correct 2 ms 796 KB Output is correct
17 Correct 1 ms 852 KB Output is correct
18 Correct 2 ms 752 KB Output is correct
19 Correct 2 ms 724 KB Output is correct
20 Correct 1 ms 724 KB Output is correct
21 Correct 1 ms 724 KB Output is correct
22 Correct 2 ms 852 KB Output is correct
23 Correct 1 ms 852 KB Output is correct
24 Correct 2 ms 852 KB Output is correct
25 Correct 2 ms 724 KB Output is correct
26 Correct 265 ms 17824 KB Output is correct
27 Correct 176 ms 17884 KB Output is correct
28 Correct 938 ms 15604 KB Output is correct
29 Correct 649 ms 17332 KB Output is correct
30 Correct 132 ms 15488 KB Output is correct
31 Correct 136 ms 15712 KB Output is correct
32 Execution timed out 1077 ms 12304 KB Time limit exceeded
33 Halted 0 ms 0 KB -