Submission #736838

# Submission time Handle Problem Language Result Execution time Memory
736838 2023-05-06T09:35:39 Z VadimK Kutije (COCI21_kutije) C++17
35 / 70
1000 ms 13488 KB
#include <bits/stdc++.h>

using namespace std;
vector <int> g[1005];
int vis[1005];
void dfs (int v, int cmp)
{
    vis[v]=cmp;
    for (int i=0; i<g[v].size(); i++)
        if (!vis[g[v][i]]) dfs(g[v][i],cmp);
}
int main()
{
    int n,m,q;
    cin>>n>>m>>q;
    for (int i=1; i<=m; i++)
        for (int j=1; j<=n; j++)
        {
            int v;
            cin>>v;
            g[j].push_back(v);
        }
    int cmp=1;
    for (int i=1; i<=n; i++)
    {
        if (!vis[i]) dfs(i,cmp);
        cmp++;
    }
    while (q--)
    {
        int a,b;
        cin>>a>>b;
        if (vis[a]==vis[b]) cout<<"DA";
        else cout<<"NE";
        cout<<"\n";
    }
}

Compilation message

Main.cpp: In function 'void dfs(int, int)':
Main.cpp:9:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     for (int i=0; i<g[v].size(); i++)
      |                   ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 850 ms 5624 KB Output is correct
2 Correct 739 ms 4968 KB Output is correct
3 Correct 692 ms 4684 KB Output is correct
4 Correct 837 ms 5732 KB Output is correct
5 Correct 811 ms 5708 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 2 ms 336 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 2 ms 336 KB Output is correct
8 Correct 3 ms 340 KB Output is correct
9 Correct 3 ms 340 KB Output is correct
10 Correct 3 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 2 ms 336 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 2 ms 336 KB Output is correct
8 Correct 3 ms 340 KB Output is correct
9 Correct 3 ms 340 KB Output is correct
10 Correct 3 ms 340 KB Output is correct
11 Correct 3 ms 404 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 3 ms 392 KB Output is correct
14 Correct 2 ms 340 KB Output is correct
15 Correct 2 ms 336 KB Output is correct
16 Correct 2 ms 340 KB Output is correct
17 Correct 3 ms 340 KB Output is correct
18 Correct 2 ms 340 KB Output is correct
19 Correct 3 ms 340 KB Output is correct
20 Correct 3 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 850 ms 5624 KB Output is correct
2 Correct 739 ms 4968 KB Output is correct
3 Correct 692 ms 4684 KB Output is correct
4 Correct 837 ms 5732 KB Output is correct
5 Correct 811 ms 5708 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 3 ms 340 KB Output is correct
8 Correct 2 ms 336 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 2 ms 336 KB Output is correct
13 Correct 3 ms 340 KB Output is correct
14 Correct 3 ms 340 KB Output is correct
15 Correct 3 ms 340 KB Output is correct
16 Correct 3 ms 404 KB Output is correct
17 Correct 2 ms 340 KB Output is correct
18 Correct 3 ms 392 KB Output is correct
19 Correct 2 ms 340 KB Output is correct
20 Correct 2 ms 336 KB Output is correct
21 Correct 2 ms 340 KB Output is correct
22 Correct 3 ms 340 KB Output is correct
23 Correct 2 ms 340 KB Output is correct
24 Correct 3 ms 340 KB Output is correct
25 Correct 3 ms 340 KB Output is correct
26 Execution timed out 1032 ms 13488 KB Time limit exceeded
27 Halted 0 ms 0 KB -