Submission #867942

#TimeUsernameProblemLanguageResultExecution timeMemory
867942becaidoKutije (COCI21_kutije)C++17
70 / 70
174 ms10544 KiB
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx,popcnt,sse4,abm") #include <bits/stdc++.h> using namespace std; #ifdef WAIMAI #define debug(HEHE...) cout << "[" << #HEHE << "] : ", dout(HEHE) void dout() {cout << '\n';} template<typename T, typename...U> void dout (T t, U...u) {cout << t << (sizeof... (u) ? ", " : ""), dout (u...);} #else #define debug(...) 7122 #endif #define ll long long #define Waimai ios::sync_with_stdio(false), cin.tie(0) #define FOR(x,a,b) for (int x = a, I = b; x <= I; x++) #define pb emplace_back #define F first #define S second const int SIZE = 1005; int n, m, q; bool g[SIZE][SIZE]; void solve() { cin >> n >> m >> q; while (m--) { FOR (i, 1, n) { int p; cin >> p; g[p][i] = 1; } } FOR (k, 1, n) FOR (i, 1, n) if (g[i][k]) FOR (j, 1, n) g[i][j] |= g[k][j]; while (q--) { int a, b; cin >> a >> b; cout << (g[a][b] ? "DA" : "NE") << '\n'; } } int main() { Waimai; solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...