Submission #1028820

#TimeUsernameProblemLanguageResultExecution timeMemory
1028820atomKutije (COCI21_kutije)C++17
70 / 70
886 ms14680 KiB
#include "bits/stdc++.h" // @JASPER'S BOILERPLATE using namespace std; using ll = long long; #ifdef JASPER #include "debug.h" #else #define debug(...) 166 #endif const int N = 1005; vector <int> adj[N]; bool vis[N][N]; void dfs(int r, int u) { vis[r][u] = true; for (int v : adj[u]) { if (!vis[r][v]) { dfs(r, v); } } } signed main() { cin.tie(0) -> sync_with_stdio(0); #ifdef JASPER freopen("in1", "r", stdin); #endif int n, m, q; cin >> n >> m >> q; for (int i = 1; i <= m; ++i) { for (int j = 1; j <= n; ++j) { int x; cin >> x; adj[j].push_back(x); } } for (int i = 1; i <= n; ++i) { sort(adj[i].begin(), adj[i].end()); adj[i].resize(unique(adj[i].begin(), adj[i].end()) - adj[i].begin()); } for (int i = 1; i <= n; ++i) { dfs(i, i); } for (int i = 1; i <= q; ++i) { int u, v; cin >> u >> v; debug(u, v); cout << (vis[u][v]? "DA" : "NE") << "\n"; } return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:9:20: warning: statement has no effect [-Wunused-value]
    9 | #define debug(...) 166
      |                    ^~~
Main.cpp:55:9: note: in expansion of macro 'debug'
   55 |         debug(u, v);
      |         ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...