Submission #1102429

#TimeUsernameProblemLanguageResultExecution timeMemory
1102429yavuzskarahanKutije (COCI21_kutije)C++14
20 / 70
1033 ms2892 KiB
// In the name of God, the Most Gracious, the Most Merciful. // iflbot(); - @yavuzskarahan #include <bits/stdc++.h> using namespace std; #define fast ios_base::sync_with_stdio(false); cin.tie(NULL); #define file(x) freopen(x ".in", "r", stdin); freopen(x ".out", "w", stdout); #define F0R(i, R) for (int i = (0); i < (R); i++) #define FOR(i, L, R) for (int i = (L); i <= (R); i++) #define SORT(v) sort((v).begin(), (v).end()) #define RSORT(v) sort((v).rbegin(), (v).rend()) #define ll long long #define int long long #define pb push_back #define ub(v, a) upper_bound((v).begin(), (v).end(), (a)) #define lb(v, a) lower_bound((v).begin(), (v).end(), (a)) #define f first #define s second #define space << " " << #define vi vector<int> #define pii pair<int,int> #define vpii vector<pair<int,int>> #define now chrono::high_resolution_clock::now() const long long N = 2e6+5; const long long MOD = 1e9+7; int n, m, q, a, b, u, v; vi adj[1005]; bool visited[1005]; inline bool dfs(int v, int p, int target){ if (v==target) return true; if (visited[v]) return false; visited[v] = true; for(auto u : adj[v]){ if (dfs(u,v,target)) return true; } return false; } inline int solve(){ cin >> n >> m >> q; FOR(i,1,m){ FOR(j,1,n){ cin >> a; adj[j].pb(a); } } while(q--){ FOR(i,1,n) visited[i] = false; cin >> a >> b; cout << (dfs(a,a,b) ? "DA" : "NE") << endl; } return 0; } int32_t main() { #ifdef LOCAL auto start = now; #endif fast; //file("wormsort"); int t = 1; //cin >> t; while(t--){ solve(); } #ifdef LOCAL auto end = now; chrono::duration<double> elapsed = end - start; cout << endl << "runtime: " << endl << elapsed.count() << endl; #endif return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...