Submission #736838

#TimeUsernameProblemLanguageResultExecution timeMemory
736838VadimKKutije (COCI21_kutije)C++17
35 / 70
1032 ms13488 KiB
#include <bits/stdc++.h> using namespace std; vector <int> g[1005]; int vis[1005]; void dfs (int v, int cmp) { vis[v]=cmp; for (int i=0; i<g[v].size(); i++) if (!vis[g[v][i]]) dfs(g[v][i],cmp); } int main() { int n,m,q; cin>>n>>m>>q; for (int i=1; i<=m; i++) for (int j=1; j<=n; j++) { int v; cin>>v; g[j].push_back(v); } int cmp=1; for (int i=1; i<=n; i++) { if (!vis[i]) dfs(i,cmp); cmp++; } while (q--) { int a,b; cin>>a>>b; if (vis[a]==vis[b]) cout<<"DA"; else cout<<"NE"; cout<<"\n"; } }

Compilation message (stderr)

Main.cpp: In function 'void dfs(int, int)':
Main.cpp:9:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     for (int i=0; i<g[v].size(); i++)
      |                   ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...