답안 #987921

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
987921 2024-05-23T19:25:13 Z Augustyn Kutije (COCI21_kutije) C++17
35 / 70
1000 ms 13672 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ssize(a) ((int)(a.size()))

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, m, q;
    cin >> n >> m >> q;
    vector<vector<int>>pol(n);
    for(int i = 0; i < m; ++i)
    {
        for(int j = 0; j < n; ++j)
        {
            int pi;
            cin >> pi;
            --pi;
            pol[j].push_back(pi);
        }
    }

    vector<vector<bool>>jest_pol(n, vector<bool>(n));
    for(int i = 0; i < n; ++i)
    {
        queue<int>kol;
        kol.push(i);
        jest_pol[i][i] = 1;
        while(!kol.empty())
        {
            int t = kol.front();
            kol.pop();
            for(auto j: pol[t])
                if(jest_pol[i][j] == 0)
                {
                    jest_pol[i][j] = 1;
                    kol.push(j);
                }
        }
    }
    while(q)
    {
        --q;
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        if(jest_pol[a][b])
            cout << "DA\n";
        else
            cout << "NE\n";
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 71 ms 5968 KB Output is correct
2 Correct 61 ms 5204 KB Output is correct
3 Correct 55 ms 4984 KB Output is correct
4 Correct 70 ms 5968 KB Output is correct
5 Correct 72 ms 6280 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 2 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 2 ms 348 KB Output is correct
7 Correct 2 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 2 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 2 ms 348 KB Output is correct
7 Correct 2 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 3 ms 464 KB Output is correct
14 Correct 1 ms 548 KB Output is correct
15 Correct 1 ms 544 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 2 ms 344 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 71 ms 5968 KB Output is correct
2 Correct 61 ms 5204 KB Output is correct
3 Correct 55 ms 4984 KB Output is correct
4 Correct 70 ms 5968 KB Output is correct
5 Correct 72 ms 6280 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 2 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 2 ms 348 KB Output is correct
12 Correct 2 ms 344 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 344 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 3 ms 464 KB Output is correct
19 Correct 1 ms 548 KB Output is correct
20 Correct 1 ms 544 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 2 ms 344 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 212 ms 13672 KB Output is correct
27 Correct 126 ms 13648 KB Output is correct
28 Correct 834 ms 11764 KB Output is correct
29 Correct 609 ms 13396 KB Output is correct
30 Correct 99 ms 12008 KB Output is correct
31 Correct 112 ms 11860 KB Output is correct
32 Execution timed out 1054 ms 12952 KB Time limit exceeded
33 Halted 0 ms 0 KB -