Submission #675846

# Submission time Handle Problem Language Result Execution time Memory
675846 2022-12-28T07:17:47 Z Tangirkul Kutije (COCI21_kutije) C++17
70 / 70
167 ms 17632 KB
#include<bits/stdc++.h>
  
#define ll long long
#define fi first
#define se second
#define pb push_back
#define sz size
#define Junanna ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  
using namespace std;
  
const ll K = 32;
const ll INF = 1e9 + 7;
const ll MOD = 1e9 + 7;
const ll N = (1e5 + 125);

ll n, m, q;
vector <ll> g[1007];
ll p[1007];
bool used[1007];

void dfs (ll v, ll st)
{
    p[v] = st;
    used[v] = 1;
    for (ll i = 0; i < g[v].sz (); i++)
    {
        ll to = g[v][i];
        if (!used[to])
        {
            dfs (to, st);
        }
    }
}
 
void ma1n ()
{
    cin >> n >> m >> q;
    for (ll j = 1; j <= m; j++)
    {
        for (ll i = 1; i <= n; i++)
        {
            ll p;
            cin >> p;
            g[i].pb (p);
        }
    }
    for (ll i = 1; i <= n; i++)
    {
        if (!used[i])
        {
            dfs (i, i);
        }
    }
    for (ll i = 1; i <= q; i++)
    {
        ll a, b;
        cin >> a >> b;
        if (p[a] == p[b])
        {
            cout << "DA\n";
        }
        else
        {
            cout << "NE\n";
        }
    }
}
    
int main ()
{
    Junanna;
    ll t = 1;
    while (t--)
    {
        ma1n ();
    }
    return 0;
}

Compilation message

Main.cpp: In function 'void dfs(long long int, long long int)':
Main.cpp:26:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |     for (ll i = 0; i < g[v].sz (); i++)
      |                    ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 70 ms 1816 KB Output is correct
2 Correct 81 ms 1584 KB Output is correct
3 Correct 57 ms 1612 KB Output is correct
4 Correct 69 ms 1856 KB Output is correct
5 Correct 69 ms 1816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 468 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 468 KB Output is correct
9 Correct 1 ms 468 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 468 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 468 KB Output is correct
9 Correct 1 ms 468 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 2 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 1816 KB Output is correct
2 Correct 81 ms 1584 KB Output is correct
3 Correct 57 ms 1612 KB Output is correct
4 Correct 69 ms 1856 KB Output is correct
5 Correct 69 ms 1816 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 468 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 468 KB Output is correct
14 Correct 1 ms 468 KB Output is correct
15 Correct 1 ms 468 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 2 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 468 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 167 ms 9856 KB Output is correct
27 Correct 128 ms 9824 KB Output is correct
28 Correct 113 ms 8980 KB Output is correct
29 Correct 150 ms 17008 KB Output is correct
30 Correct 121 ms 15420 KB Output is correct
31 Correct 125 ms 15324 KB Output is correct
32 Correct 141 ms 17540 KB Output is correct
33 Correct 135 ms 17496 KB Output is correct
34 Correct 142 ms 17632 KB Output is correct
35 Correct 137 ms 17500 KB Output is correct