# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
649530 | GudStonks | Kutije (COCI21_kutije) | C++17 | 1087 ms | 14964 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |