Submission #720690

#TimeUsernameProblemLanguageResultExecution timeMemory
720690Yell0Kutije (COCI21_kutije)C++17
70 / 70
804 ms14796 KiB
#include <bits/stdc++.h> using namespace std; const int MN=1002; int n,m,q; vector<int> adj[MN]; bool vis[MN]; bool dest[MN][MN]; void dfs(int u,int p) { vis[u]=1; dest[p][u]=1; for(int v:adj[u]) if(!vis[v]) dfs(v,p); } int main() { ios::sync_with_stdio(0);cin.tie(0); cin>>n>>m>>q; for(int i=1;i<=m;i++) for(int u=1,v;u<=n;u++) { cin>>v; adj[v].push_back(u); } memset(dest,0,sizeof(dest)); for(int i=1;i<=n;i++) { memset(vis,0,sizeof(vis)); dfs(i,i); } int a,b; while(q--) { cin>>a>>b; if(dest[a][b]) cout<<"DA\n"; else cout<<"NE\n"; } return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:21:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   21 |     for(int i=1;i<=m;i++)
      |     ^~~
Main.cpp:26:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   26 |  memset(dest,0,sizeof(dest));
      |  ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...