Submission #1006080

#TimeUsernameProblemLanguageResultExecution timeMemory
1006080DangerNoodle7591Kutije (COCI21_kutije)C++17
70 / 70
729 ms17920 KiB
#include <bits/stdc++.h> using namespace std; #define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define endl '\n' //#define int long long int //#define ll long long #define pb push_back #define p push #define f first #define s second #define N 1005 vector<int> adj[N]; int deg[N][N]; void dfs(int x,int ata){ if(deg[ata][x])return; deg[ata][x]=1; for(auto u:adj[x]){ if(deg[ata][u]==0)dfs(u,ata); } } signed main(){ lalala; int n,m,q;cin>>n>>m>>q; for(int i=0;i<m;i++){ for(int i=1;i<=n;i++){ int x;cin>>x; adj[x].pb(i); } } for(int i=1;i<=n;i++){ dfs(i,i); } while(q--){ int a,b;cin>>a>>b; if(deg[a][b])cout<<"DA"<<endl; else cout<<"NE"<<endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...