Submission #649531

# Submission time Handle Problem Language Result Execution time Memory
649531 2022-10-10T11:44:11 Z GudStonks Kutije (COCI21_kutije) C++17
35 / 70
1000 ms 14984 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()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	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++)
      |                 ~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 710 ms 2800 KB Output is correct
2 Correct 596 ms 2732 KB Output is correct
3 Correct 563 ms 2452 KB Output is correct
4 Correct 662 ms 2856 KB Output is correct
5 Correct 695 ms 2772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 468 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 2 ms 468 KB Output is correct
4 Correct 3 ms 468 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 468 KB Output is correct
7 Correct 3 ms 468 KB Output is correct
8 Correct 1 ms 468 KB Output is correct
9 Correct 2 ms 468 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 468 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 2 ms 468 KB Output is correct
4 Correct 3 ms 468 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 468 KB Output is correct
7 Correct 3 ms 468 KB Output is correct
8 Correct 1 ms 468 KB Output is correct
9 Correct 2 ms 468 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
11 Correct 2 ms 468 KB Output is correct
12 Correct 2 ms 544 KB Output is correct
13 Correct 3 ms 468 KB Output is correct
14 Correct 2 ms 468 KB Output is correct
15 Correct 1 ms 468 KB Output is correct
16 Correct 1 ms 468 KB Output is correct
17 Correct 3 ms 468 KB Output is correct
18 Correct 2 ms 468 KB Output is correct
19 Correct 1 ms 468 KB Output is correct
20 Correct 2 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 710 ms 2800 KB Output is correct
2 Correct 596 ms 2732 KB Output is correct
3 Correct 563 ms 2452 KB Output is correct
4 Correct 662 ms 2856 KB Output is correct
5 Correct 695 ms 2772 KB Output is correct
6 Correct 2 ms 468 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 2 ms 468 KB Output is correct
9 Correct 3 ms 468 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
11 Correct 1 ms 468 KB Output is correct
12 Correct 3 ms 468 KB Output is correct
13 Correct 1 ms 468 KB Output is correct
14 Correct 2 ms 468 KB Output is correct
15 Correct 1 ms 468 KB Output is correct
16 Correct 2 ms 468 KB Output is correct
17 Correct 2 ms 544 KB Output is correct
18 Correct 3 ms 468 KB Output is correct
19 Correct 2 ms 468 KB Output is correct
20 Correct 1 ms 468 KB Output is correct
21 Correct 1 ms 468 KB Output is correct
22 Correct 3 ms 468 KB Output is correct
23 Correct 2 ms 468 KB Output is correct
24 Correct 1 ms 468 KB Output is correct
25 Correct 2 ms 468 KB Output is correct
26 Correct 825 ms 7320 KB Output is correct
27 Correct 723 ms 14984 KB Output is correct
28 Execution timed out 1074 ms 10864 KB Time limit exceeded
29 Halted 0 ms 0 KB -