Submission #649530

#TimeUsernameProblemLanguageResultExecution timeMemory
649530GudStonksKutije (COCI21_kutije)C++17
35 / 70
1087 ms14964 KiB
#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)

Main.cpp: In function 'void dfs(int, int)':
Main.cpp:10:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |  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...