Submission #1237322

#TimeUsernameProblemLanguageResultExecution timeMemory
1237322atsoukalasKutije (COCI21_kutije)C++20
20 / 70
1096 ms1376 KiB
#include <bits/stdc++.h> using namespace std; vector<int> Adj[1005]; bool V[1005]; int main() { int N, M, Q; scanf("%d%d%d", &N, &M, &Q); for(int i=0;i<M;++i){ for(int j=1;j<=N;++j){ int tmp; scanf("%d", &tmp); bool exists=false; for(int k=0;k<Adj[j].size();++k){ if(Adj[j][k]==tmp) exists = true; } if(!exists) Adj[j].push_back(tmp); } } for(int i=0; i<Q; ++i){ int S, G; scanf("%d%d", &S, &G); queue<int> Q; Q.push(S); V[S] = true; while(!Q.empty()){ int curr = Q.front(); Q.pop(); if(curr==G) { V[G] = true; break; } for(int j=0; j<Adj[curr].size();++j){ if(!V[Adj[curr][j]]){ Q.push(Adj[curr][j]); V[Adj[curr][j]] = true; } } } if(V[G]) printf("DA\n"); else printf("NE\n"); fill(V, V+N+1, false); } return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d%d%d", &N, &M, &Q);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
Main.cpp:13:27: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |             int tmp; scanf("%d", &tmp);
      |                      ~~~~~^~~~~~~~~~~~
Main.cpp:23:24: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |         int S, G; scanf("%d%d", &S, &G);
      |                   ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...