Submission #675824

# Submission time Handle Problem Language Result Execution time Memory
675824 2022-12-28T04:58:50 Z Tangirkul Kutije (COCI21_kutije) C++17
35 / 70
1000 ms 18540 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];
bool used[1007][1007];

void dfs (ll v, ll st)
{
    used[st][v] = 1;
    for (ll i = 0; i < g[v].sz (); i++)
    {
        ll to = g[v][i];
        if (!used[st][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++)
    {
        dfs (i, i);
    }
    for (ll i = 1; i <= q; i++)
    {
        ll a, b;
        cin >> a >> b;
        if (used[a][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:24: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]
   24 |     for (ll i = 0; i < g[v].sz (); i++)
      |                    ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 91 ms 6692 KB Output is correct
2 Correct 78 ms 5904 KB Output is correct
3 Correct 83 ms 5544 KB Output is correct
4 Correct 100 ms 6668 KB Output is correct
5 Correct 90 ms 6592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 596 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Correct 2 ms 468 KB Output is correct
4 Correct 2 ms 596 KB Output is correct
5 Correct 1 ms 552 KB Output is correct
6 Correct 2 ms 500 KB Output is correct
7 Correct 3 ms 596 KB Output is correct
8 Correct 2 ms 492 KB Output is correct
9 Correct 2 ms 596 KB Output is correct
10 Correct 2 ms 720 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 596 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Correct 2 ms 468 KB Output is correct
4 Correct 2 ms 596 KB Output is correct
5 Correct 1 ms 552 KB Output is correct
6 Correct 2 ms 500 KB Output is correct
7 Correct 3 ms 596 KB Output is correct
8 Correct 2 ms 492 KB Output is correct
9 Correct 2 ms 596 KB Output is correct
10 Correct 2 ms 720 KB Output is correct
11 Correct 1 ms 596 KB Output is correct
12 Correct 1 ms 596 KB Output is correct
13 Correct 2 ms 468 KB Output is correct
14 Correct 1 ms 468 KB Output is correct
15 Correct 1 ms 492 KB Output is correct
16 Correct 1 ms 492 KB Output is correct
17 Correct 3 ms 492 KB Output is correct
18 Correct 1 ms 492 KB Output is correct
19 Correct 2 ms 596 KB Output is correct
20 Correct 1 ms 596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 91 ms 6692 KB Output is correct
2 Correct 78 ms 5904 KB Output is correct
3 Correct 83 ms 5544 KB Output is correct
4 Correct 100 ms 6668 KB Output is correct
5 Correct 90 ms 6592 KB Output is correct
6 Correct 2 ms 596 KB Output is correct
7 Correct 1 ms 596 KB Output is correct
8 Correct 2 ms 468 KB Output is correct
9 Correct 2 ms 596 KB Output is correct
10 Correct 1 ms 552 KB Output is correct
11 Correct 2 ms 500 KB Output is correct
12 Correct 3 ms 596 KB Output is correct
13 Correct 2 ms 492 KB Output is correct
14 Correct 2 ms 596 KB Output is correct
15 Correct 2 ms 720 KB Output is correct
16 Correct 1 ms 596 KB Output is correct
17 Correct 1 ms 596 KB Output is correct
18 Correct 2 ms 468 KB Output is correct
19 Correct 1 ms 468 KB Output is correct
20 Correct 1 ms 492 KB Output is correct
21 Correct 1 ms 492 KB Output is correct
22 Correct 3 ms 492 KB Output is correct
23 Correct 1 ms 492 KB Output is correct
24 Correct 2 ms 596 KB Output is correct
25 Correct 1 ms 596 KB Output is correct
26 Correct 329 ms 18540 KB Output is correct
27 Correct 153 ms 18496 KB Output is correct
28 Execution timed out 1047 ms 16136 KB Time limit exceeded
29 Halted 0 ms 0 KB -