Submission #867942

# Submission time Handle Problem Language Result Execution time Memory
867942 2023-10-30T00:23:02 Z becaido Kutije (COCI21_kutije) C++17
70 / 70
174 ms 10544 KB
#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 time Memory Grader output
1 Correct 72 ms 6528 KB Output is correct
2 Correct 64 ms 5968 KB Output is correct
3 Correct 60 ms 5460 KB Output is correct
4 Correct 70 ms 6740 KB Output is correct
5 Correct 93 ms 6588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 592 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 592 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 548 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 72 ms 6528 KB Output is correct
2 Correct 64 ms 5968 KB Output is correct
3 Correct 60 ms 5460 KB Output is correct
4 Correct 70 ms 6740 KB Output is correct
5 Correct 93 ms 6588 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 592 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 2 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 548 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 344 KB Output is correct
26 Correct 133 ms 10388 KB Output is correct
27 Correct 141 ms 10320 KB Output is correct
28 Correct 140 ms 8788 KB Output is correct
29 Correct 144 ms 10064 KB Output is correct
30 Correct 99 ms 9044 KB Output is correct
31 Correct 112 ms 8828 KB Output is correct
32 Correct 174 ms 10364 KB Output is correct
33 Correct 117 ms 10368 KB Output is correct
34 Correct 124 ms 10364 KB Output is correct
35 Correct 118 ms 10544 KB Output is correct