Submission #994170

# Submission time Handle Problem Language Result Execution time Memory
994170 2024-06-07T08:15:04 Z bachhoangxuan Island Hopping (JOI24_island) C++17
100 / 100
10 ms 860 KB
#include "island.h"
#include<bits/stdc++.h>
using namespace std;
const int maxn = 305;
int d[maxn][maxn];

int Query(int v,int k){
    if(d[v][k]) return d[v][k];
    else return d[v][k]=query(v,k);
}

int dd[maxn],par[maxn];

int findpar(int u){
    if(u!=par[u]) return par[u]=findpar(par[u]);
    return u;
}
void unions(int u,int v){
    u=findpar(u);v=findpar(v);
    if(u!=v) par[v]=u;
}

void solve(int N, int L) {
    for(int i=1;i<=N;i++) par[i]=i,dd[i]=1;
    for(int i=1;i<=N;i++){
        for(int u=1;u<=N;u++){
            if(findpar(u)!=findpar(i) && Query(u,dd[u])==i){
                dd[u]++;
                //cout << u << ' ' << i << endl;
                answer(u,i);
                unions(u,i);
            }
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 6 ms 692 KB Output is correct
6 Correct 5 ms 600 KB Output is correct
7 Correct 5 ms 612 KB Output is correct
8 Correct 5 ms 708 KB Output is correct
9 Correct 5 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 632 KB Output is correct
2 Correct 5 ms 600 KB Output is correct
3 Correct 7 ms 600 KB Output is correct
4 Correct 7 ms 600 KB Output is correct
5 Correct 5 ms 692 KB Output is correct
6 Correct 7 ms 628 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 5 ms 716 KB Output is correct
3 Correct 5 ms 600 KB Output is correct
4 Correct 6 ms 600 KB Output is correct
5 Correct 6 ms 856 KB Output is correct
6 Correct 5 ms 696 KB Output is correct
7 Correct 5 ms 700 KB Output is correct
8 Correct 5 ms 600 KB Output is correct
9 Correct 6 ms 732 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 692 KB Output is correct
2 Correct 5 ms 704 KB Output is correct
3 Correct 7 ms 856 KB Output is correct
4 Correct 5 ms 612 KB Output is correct
5 Correct 6 ms 692 KB Output is correct
6 Correct 5 ms 572 KB Output is correct
7 Correct 5 ms 608 KB Output is correct
8 Correct 6 ms 608 KB Output is correct
9 Correct 7 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 6 ms 692 KB Output is correct
6 Correct 5 ms 600 KB Output is correct
7 Correct 5 ms 612 KB Output is correct
8 Correct 5 ms 708 KB Output is correct
9 Correct 5 ms 600 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 5 ms 716 KB Output is correct
12 Correct 5 ms 600 KB Output is correct
13 Correct 6 ms 600 KB Output is correct
14 Correct 6 ms 856 KB Output is correct
15 Correct 5 ms 696 KB Output is correct
16 Correct 5 ms 700 KB Output is correct
17 Correct 5 ms 600 KB Output is correct
18 Correct 6 ms 732 KB Output is correct
19 Correct 6 ms 600 KB Output is correct
20 Correct 7 ms 664 KB Output is correct
21 Correct 6 ms 728 KB Output is correct
22 Correct 5 ms 600 KB Output is correct
23 Correct 5 ms 600 KB Output is correct
24 Correct 5 ms 600 KB Output is correct
25 Correct 5 ms 600 KB Output is correct
26 Correct 5 ms 600 KB Output is correct
27 Correct 5 ms 600 KB Output is correct
28 Correct 5 ms 600 KB Output is correct
29 Correct 5 ms 600 KB Output is correct
30 Correct 5 ms 600 KB Output is correct
31 Correct 5 ms 856 KB Output is correct
32 Correct 6 ms 856 KB Output is correct
33 Correct 7 ms 592 KB Output is correct
34 Correct 4 ms 600 KB Output is correct
35 Correct 6 ms 692 KB Output is correct
36 Correct 5 ms 600 KB Output is correct
37 Correct 7 ms 600 KB Output is correct
38 Correct 8 ms 600 KB Output is correct
39 Correct 6 ms 692 KB Output is correct
40 Correct 7 ms 600 KB Output is correct
41 Correct 5 ms 692 KB Output is correct
42 Correct 4 ms 600 KB Output is correct
43 Correct 7 ms 624 KB Output is correct
44 Correct 5 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 5 ms 692 KB Output is correct
5 Correct 5 ms 704 KB Output is correct
6 Correct 7 ms 856 KB Output is correct
7 Correct 5 ms 612 KB Output is correct
8 Correct 6 ms 692 KB Output is correct
9 Correct 5 ms 572 KB Output is correct
10 Correct 5 ms 608 KB Output is correct
11 Correct 6 ms 608 KB Output is correct
12 Correct 7 ms 604 KB Output is correct
13 Correct 5 ms 696 KB Output is correct
14 Correct 6 ms 860 KB Output is correct
15 Correct 5 ms 600 KB Output is correct
16 Correct 5 ms 600 KB Output is correct
17 Correct 5 ms 600 KB Output is correct
18 Correct 5 ms 700 KB Output is correct
19 Correct 5 ms 600 KB Output is correct
20 Correct 5 ms 700 KB Output is correct
21 Correct 3 ms 620 KB Output is correct
22 Correct 5 ms 600 KB Output is correct
23 Correct 5 ms 736 KB Output is correct
24 Correct 6 ms 696 KB Output is correct
25 Correct 5 ms 600 KB Output is correct
26 Correct 5 ms 600 KB Output is correct
27 Correct 7 ms 600 KB Output is correct
28 Correct 5 ms 600 KB Output is correct
29 Correct 5 ms 700 KB Output is correct
30 Correct 8 ms 600 KB Output is correct
31 Correct 7 ms 600 KB Output is correct
32 Correct 6 ms 600 KB Output is correct
33 Correct 6 ms 600 KB Output is correct
34 Correct 5 ms 600 KB Output is correct
35 Correct 5 ms 576 KB Output is correct
36 Correct 7 ms 600 KB Output is correct
37 Correct 7 ms 600 KB Output is correct
38 Correct 7 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 632 KB Output is correct
2 Correct 5 ms 600 KB Output is correct
3 Correct 7 ms 600 KB Output is correct
4 Correct 7 ms 600 KB Output is correct
5 Correct 5 ms 692 KB Output is correct
6 Correct 7 ms 628 KB Output is correct
7 Correct 5 ms 600 KB Output is correct
8 Correct 6 ms 700 KB Output is correct
9 Correct 5 ms 608 KB Output is correct
10 Correct 7 ms 612 KB Output is correct
11 Correct 5 ms 692 KB Output is correct
12 Correct 6 ms 608 KB Output is correct
13 Correct 5 ms 600 KB Output is correct
14 Correct 5 ms 600 KB Output is correct
15 Correct 5 ms 600 KB Output is correct
16 Correct 5 ms 600 KB Output is correct
17 Correct 5 ms 780 KB Output is correct
18 Correct 5 ms 696 KB Output is correct
19 Correct 6 ms 600 KB Output is correct
20 Correct 5 ms 696 KB Output is correct
21 Correct 4 ms 600 KB Output is correct
22 Correct 5 ms 600 KB Output is correct
23 Correct 7 ms 600 KB Output is correct
24 Correct 5 ms 856 KB Output is correct
25 Correct 5 ms 600 KB Output is correct
26 Correct 5 ms 600 KB Output is correct
27 Correct 5 ms 752 KB Output is correct
28 Correct 5 ms 600 KB Output is correct
29 Correct 5 ms 600 KB Output is correct
30 Correct 10 ms 600 KB Output is correct
31 Correct 4 ms 600 KB Output is correct
32 Correct 5 ms 600 KB Output is correct
33 Correct 5 ms 600 KB Output is correct
34 Correct 5 ms 600 KB Output is correct
35 Correct 5 ms 600 KB Output is correct
36 Correct 6 ms 600 KB Output is correct
37 Correct 5 ms 600 KB Output is correct
38 Correct 5 ms 700 KB Output is correct
39 Correct 4 ms 600 KB Output is correct
40 Correct 5 ms 696 KB Output is correct