답안 #649530

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
649530 2022-10-10T11:42:52 Z GudStonks Kutije (COCI21_kutije) C++17
35 / 70
1000 ms 14964 KB
#include<bits/stdc++.h>
using namespace std;
bool us[1005][1005];
vector<int>g[1005];
int m, n, q;

void dfs(int v, int st)
{
	us[st][v] = 1;
	for(int i = 0; i < g[v].size(); i++)
	{
		if(!us[st][g[v][i]])
			dfs(g[v][i], st);
	}
}

void fun()
{
	cin>>m>>n>>q;
	for(int i = 1; i <= n; i++)
	{
		for(int j = 1, a; j <= m; j++)
		{
			cin>>a;
			g[a].push_back(j);
		}
	}
	for(int i = 1; i <= m; i++)
	{
		dfs(i, i);
	}
	for(int i = 1, a, b; i <= q; i++)
	{
		cin>>a>>b;
		cout<<((us[a][b]) ? "DA" : "NE")<<endl;
	}
}
int main()
{
	int ttt = 1;
	//cin>>ttt;
	while(ttt--)
		fun();
}

Compilation message

Main.cpp: In function 'void dfs(int, int)':
Main.cpp:10:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |  for(int i = 0; i < g[v].size(); i++)
      |                 ~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 807 ms 6680 KB Output is correct
2 Correct 729 ms 6024 KB Output is correct
3 Correct 661 ms 5608 KB Output is correct
4 Correct 844 ms 6652 KB Output is correct
5 Correct 805 ms 6620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 472 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
3 Correct 3 ms 468 KB Output is correct
4 Correct 3 ms 472 KB Output is correct
5 Correct 2 ms 468 KB Output is correct
6 Correct 3 ms 468 KB Output is correct
7 Correct 3 ms 404 KB Output is correct
8 Correct 3 ms 468 KB Output is correct
9 Correct 3 ms 468 KB Output is correct
10 Correct 3 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 472 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
3 Correct 3 ms 468 KB Output is correct
4 Correct 3 ms 472 KB Output is correct
5 Correct 2 ms 468 KB Output is correct
6 Correct 3 ms 468 KB Output is correct
7 Correct 3 ms 404 KB Output is correct
8 Correct 3 ms 468 KB Output is correct
9 Correct 3 ms 468 KB Output is correct
10 Correct 3 ms 468 KB Output is correct
11 Correct 3 ms 472 KB Output is correct
12 Correct 3 ms 404 KB Output is correct
13 Correct 3 ms 468 KB Output is correct
14 Correct 3 ms 468 KB Output is correct
15 Correct 3 ms 468 KB Output is correct
16 Correct 2 ms 468 KB Output is correct
17 Correct 3 ms 468 KB Output is correct
18 Correct 3 ms 468 KB Output is correct
19 Correct 3 ms 476 KB Output is correct
20 Correct 2 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 807 ms 6680 KB Output is correct
2 Correct 729 ms 6024 KB Output is correct
3 Correct 661 ms 5608 KB Output is correct
4 Correct 844 ms 6652 KB Output is correct
5 Correct 805 ms 6620 KB Output is correct
6 Correct 3 ms 472 KB Output is correct
7 Correct 3 ms 468 KB Output is correct
8 Correct 3 ms 468 KB Output is correct
9 Correct 3 ms 472 KB Output is correct
10 Correct 2 ms 468 KB Output is correct
11 Correct 3 ms 468 KB Output is correct
12 Correct 3 ms 404 KB Output is correct
13 Correct 3 ms 468 KB Output is correct
14 Correct 3 ms 468 KB Output is correct
15 Correct 3 ms 468 KB Output is correct
16 Correct 3 ms 472 KB Output is correct
17 Correct 3 ms 404 KB Output is correct
18 Correct 3 ms 468 KB Output is correct
19 Correct 3 ms 468 KB Output is correct
20 Correct 3 ms 468 KB Output is correct
21 Correct 2 ms 468 KB Output is correct
22 Correct 3 ms 468 KB Output is correct
23 Correct 3 ms 468 KB Output is correct
24 Correct 3 ms 476 KB Output is correct
25 Correct 2 ms 468 KB Output is correct
26 Execution timed out 1087 ms 14964 KB Time limit exceeded
27 Halted 0 ms 0 KB -