# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
798020 |
2023-07-30T09:33:28 Z |
tlnk07 |
Kutije (COCI21_kutije) |
C++17 |
|
724 ms |
6580 KB |
#include<bits/stdc++.h>
using namespace std;
long long n, m, q, a[1001][1001], x, y;
bool check[1001][1001];
void dfs1(int x, int y)
{
if(check[x][y]) return;
check[x][y] = true;
dfs1(x, a[1][y]);
}
int main()
{
cin >> n >> m >> q;
if(m == 1)
{
for(int i = 1; i <= n; ++i) cin >> a[1][i];
for(int i = 1; i <= n; ++i) dfs1(i, i);
while(q--)
{
cin >> x >> y;
if(check[x][y]) cout << "DA\n";
else cout << "NE\n";
}
}
else
{
for(int i = 1; i <= m; ++i) for(int j = 1; j <= n; ++j) cin >> a[i][j];
for(int i = 1; i <= m; ++i) for(int j = 1; j <= m; ++j) for(int l = 1; l <= n; ++l) check[l][l] = check[l][a[i][l]] = check[l][a[j][l]] = check[l][a[i][a[j][l]]] = check[l][a[j][a[i][l]]] = true;
while(q--)
{
cin >> x >> y;
if(check[x][y]) cout << "DA\n";
else cout << "NE\n";
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
658 ms |
6524 KB |
Output is correct |
2 |
Correct |
585 ms |
5936 KB |
Output is correct |
3 |
Correct |
534 ms |
5448 KB |
Output is correct |
4 |
Correct |
724 ms |
6568 KB |
Output is correct |
5 |
Correct |
673 ms |
6580 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
852 KB |
Output is correct |
2 |
Correct |
4 ms |
852 KB |
Output is correct |
3 |
Correct |
4 ms |
852 KB |
Output is correct |
4 |
Correct |
4 ms |
852 KB |
Output is correct |
5 |
Correct |
4 ms |
828 KB |
Output is correct |
6 |
Correct |
4 ms |
852 KB |
Output is correct |
7 |
Correct |
4 ms |
828 KB |
Output is correct |
8 |
Correct |
4 ms |
828 KB |
Output is correct |
9 |
Correct |
4 ms |
852 KB |
Output is correct |
10 |
Correct |
4 ms |
928 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
852 KB |
Output is correct |
2 |
Correct |
4 ms |
852 KB |
Output is correct |
3 |
Correct |
4 ms |
852 KB |
Output is correct |
4 |
Correct |
4 ms |
852 KB |
Output is correct |
5 |
Correct |
4 ms |
828 KB |
Output is correct |
6 |
Correct |
4 ms |
852 KB |
Output is correct |
7 |
Correct |
4 ms |
828 KB |
Output is correct |
8 |
Correct |
4 ms |
828 KB |
Output is correct |
9 |
Correct |
4 ms |
852 KB |
Output is correct |
10 |
Correct |
4 ms |
928 KB |
Output is correct |
11 |
Correct |
6 ms |
852 KB |
Output is correct |
12 |
Correct |
4 ms |
852 KB |
Output is correct |
13 |
Correct |
4 ms |
852 KB |
Output is correct |
14 |
Correct |
4 ms |
816 KB |
Output is correct |
15 |
Correct |
4 ms |
908 KB |
Output is correct |
16 |
Correct |
4 ms |
852 KB |
Output is correct |
17 |
Correct |
4 ms |
920 KB |
Output is correct |
18 |
Correct |
4 ms |
920 KB |
Output is correct |
19 |
Incorrect |
4 ms |
832 KB |
Output isn't correct |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
658 ms |
6524 KB |
Output is correct |
2 |
Correct |
585 ms |
5936 KB |
Output is correct |
3 |
Correct |
534 ms |
5448 KB |
Output is correct |
4 |
Correct |
724 ms |
6568 KB |
Output is correct |
5 |
Correct |
673 ms |
6580 KB |
Output is correct |
6 |
Correct |
5 ms |
852 KB |
Output is correct |
7 |
Correct |
4 ms |
852 KB |
Output is correct |
8 |
Correct |
4 ms |
852 KB |
Output is correct |
9 |
Correct |
4 ms |
852 KB |
Output is correct |
10 |
Correct |
4 ms |
828 KB |
Output is correct |
11 |
Correct |
4 ms |
852 KB |
Output is correct |
12 |
Correct |
4 ms |
828 KB |
Output is correct |
13 |
Correct |
4 ms |
828 KB |
Output is correct |
14 |
Correct |
4 ms |
852 KB |
Output is correct |
15 |
Correct |
4 ms |
928 KB |
Output is correct |
16 |
Correct |
6 ms |
852 KB |
Output is correct |
17 |
Correct |
4 ms |
852 KB |
Output is correct |
18 |
Correct |
4 ms |
852 KB |
Output is correct |
19 |
Correct |
4 ms |
816 KB |
Output is correct |
20 |
Correct |
4 ms |
908 KB |
Output is correct |
21 |
Correct |
4 ms |
852 KB |
Output is correct |
22 |
Correct |
4 ms |
920 KB |
Output is correct |
23 |
Correct |
4 ms |
920 KB |
Output is correct |
24 |
Incorrect |
4 ms |
832 KB |
Output isn't correct |
25 |
Halted |
0 ms |
0 KB |
- |