# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
505159 | nicecoder37 | Kutije (COCI21_kutije) | C++17 | 1071 ms | 21552 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.
/*MKAAN THE KING*/
#include <bits/stdc++.h>
#define space " "
#define endl "\n"
#define gcd __gcd
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pf push_front
#define inf 1000000000
#define md 1000000007
#define li 1005
#define lo long long
using namespace std;
int n,m,Q,x,y,a[li][li],vis[li][li];
vector<int> v[li];
void dfs(int sayi,int node){
if(vis[sayi][node]) return ;
vis[sayi][node]=1;
for(int i=0;i<(int)v[node].size();i++){
int go=v[node][i];
dfs(sayi,go);
}
}
int main(){
scanf("%d %d %d",&n,&m,&Q);
for(int i=1;i<=m;i++){
for(int j=1;j<=n;j++){
scanf("%d",&a[i][j]);
v[a[i][j]].pb(j);
}
}
for(int i=1;i<=n;i++) dfs(i,i);
while(Q--){
scanf("%d %d",&x,&y);
//~ dfs(x);
if(vis[x][y]) printf("DA\n");
else printf("NE\n");
}
return 0;
}
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... |