Submission #675581

# Submission time Handle Problem Language Result Execution time Memory
675581 2022-12-27T13:32:36 Z GudStonks Kutije (COCI21_kutije) C++17
35 / 70
1000 ms 28260 KB
#include<bits/stdc++.h>
using namespace std;
bool us[1005][1005];
set<int>g[1005];
int m, n, q;
 
void dfs(int v, int st)
{
	us[st][v] = 1;
	for(auto to : g[v])
	{
		if(!us[st][to])
			dfs(to, 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].insert(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")<<"\n";
	}
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int ttt = 1;
	//cin>>ttt;
	while(ttt--)
		fun();
}
# Verdict Execution time Memory Grader output
1 Correct 102 ms 6712 KB Output is correct
2 Correct 91 ms 6012 KB Output is correct
3 Correct 73 ms 5580 KB Output is correct
4 Correct 106 ms 6700 KB Output is correct
5 Correct 89 ms 6648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 468 KB Output is correct
2 Correct 2 ms 468 KB Output is correct
3 Correct 7 ms 648 KB Output is correct
4 Correct 4 ms 596 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 468 KB Output is correct
7 Correct 11 ms 924 KB Output is correct
8 Correct 2 ms 388 KB Output is correct
9 Correct 1 ms 424 KB Output is correct
10 Correct 1 ms 516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 468 KB Output is correct
2 Correct 2 ms 468 KB Output is correct
3 Correct 7 ms 648 KB Output is correct
4 Correct 4 ms 596 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 468 KB Output is correct
7 Correct 11 ms 924 KB Output is correct
8 Correct 2 ms 388 KB Output is correct
9 Correct 1 ms 424 KB Output is correct
10 Correct 1 ms 516 KB Output is correct
11 Correct 2 ms 520 KB Output is correct
12 Correct 1 ms 468 KB Output is correct
13 Correct 8 ms 724 KB Output is correct
14 Correct 4 ms 628 KB Output is correct
15 Correct 2 ms 396 KB Output is correct
16 Correct 2 ms 432 KB Output is correct
17 Correct 11 ms 968 KB Output is correct
18 Correct 2 ms 468 KB Output is correct
19 Correct 1 ms 516 KB Output is correct
20 Correct 2 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 102 ms 6712 KB Output is correct
2 Correct 91 ms 6012 KB Output is correct
3 Correct 73 ms 5580 KB Output is correct
4 Correct 106 ms 6700 KB Output is correct
5 Correct 89 ms 6648 KB Output is correct
6 Correct 2 ms 468 KB Output is correct
7 Correct 2 ms 468 KB Output is correct
8 Correct 7 ms 648 KB Output is correct
9 Correct 4 ms 596 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
11 Correct 1 ms 468 KB Output is correct
12 Correct 11 ms 924 KB Output is correct
13 Correct 2 ms 388 KB Output is correct
14 Correct 1 ms 424 KB Output is correct
15 Correct 1 ms 516 KB Output is correct
16 Correct 2 ms 520 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 8 ms 724 KB Output is correct
19 Correct 4 ms 628 KB Output is correct
20 Correct 2 ms 396 KB Output is correct
21 Correct 2 ms 432 KB Output is correct
22 Correct 11 ms 968 KB Output is correct
23 Correct 2 ms 468 KB Output is correct
24 Correct 1 ms 516 KB Output is correct
25 Correct 2 ms 468 KB Output is correct
26 Correct 581 ms 15052 KB Output is correct
27 Correct 198 ms 10832 KB Output is correct
28 Execution timed out 1077 ms 28260 KB Time limit exceeded
29 Halted 0 ms 0 KB -