Submission #767211

# Submission time Handle Problem Language Result Execution time Memory
767211 2023-06-26T13:57:41 Z Ahmed57 Game (APIO22_game) C++17
60 / 100
1200 ms 36636 KB
#include <bits/stdc++.h>

using namespace std;
bool arr[1001][50001];
int mi[1001];
int N,K;
vector<int> adj[50001];
void dfs(int i,int boss){
    arr[boss][i] = 1;
    mi[boss] = min(mi[boss],i);
    for(auto j:adj[i]){
        if(boss==j){
            mi[boss] = boss;
        }
        if(!arr[boss][j])dfs(j,boss);
    }
}
void init(int n, int k){
    N = n , K = k;
    for(int i = 0;i<k;i++){
        mi[i] = 1e9;
        arr[i][i] = 1;
    }
}
int add_teleporter(int u, int v){
    adj[u].push_back(v);
    bool ss = 0;
    for(int i = 0;i<K;i++){
        if(arr[i][u]&&v==i){
            mi[i] = min(mi[i],i);
        }
        if(arr[i][u]&&(!arr[i][v])){
            dfs(v,i);
        }
        if(mi[i]<=i){
            ss = 1;
        }
    }
    return ss;
}/*
int main(){
    init(6,3);
    cout<<add_teleporter(3, 4)<<endl;
    cout<<add_teleporter(5, 0)<<endl;
    cout<<add_teleporter(4, 5)<<endl;
    cout<<add_teleporter(5, 3)<<endl;
    cout<<add_teleporter(1, 4)<<endl;
}
*/
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1360 KB Output is correct
2 Correct 1 ms 1488 KB Output is correct
3 Correct 1 ms 1872 KB Output is correct
4 Correct 1 ms 1616 KB Output is correct
5 Correct 1 ms 1872 KB Output is correct
6 Correct 1 ms 1872 KB Output is correct
7 Correct 1 ms 1872 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1360 KB Output is correct
2 Correct 1 ms 1488 KB Output is correct
3 Correct 1 ms 1872 KB Output is correct
4 Correct 1 ms 1616 KB Output is correct
5 Correct 1 ms 1872 KB Output is correct
6 Correct 1 ms 1872 KB Output is correct
7 Correct 1 ms 1872 KB Output is correct
8 Correct 1 ms 1488 KB Output is correct
9 Correct 1 ms 1360 KB Output is correct
10 Correct 1 ms 1488 KB Output is correct
11 Correct 1 ms 1488 KB Output is correct
12 Correct 1 ms 1488 KB Output is correct
13 Correct 1 ms 1488 KB Output is correct
14 Correct 1 ms 1616 KB Output is correct
15 Correct 1 ms 1592 KB Output is correct
16 Correct 1 ms 1488 KB Output is correct
17 Correct 1 ms 1616 KB Output is correct
18 Correct 1 ms 1616 KB Output is correct
19 Correct 1 ms 1616 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1360 KB Output is correct
2 Correct 1 ms 1488 KB Output is correct
3 Correct 1 ms 1872 KB Output is correct
4 Correct 1 ms 1616 KB Output is correct
5 Correct 1 ms 1872 KB Output is correct
6 Correct 1 ms 1872 KB Output is correct
7 Correct 1 ms 1872 KB Output is correct
8 Correct 1 ms 1488 KB Output is correct
9 Correct 1 ms 1360 KB Output is correct
10 Correct 1 ms 1488 KB Output is correct
11 Correct 1 ms 1488 KB Output is correct
12 Correct 1 ms 1488 KB Output is correct
13 Correct 1 ms 1488 KB Output is correct
14 Correct 1 ms 1616 KB Output is correct
15 Correct 1 ms 1592 KB Output is correct
16 Correct 1 ms 1488 KB Output is correct
17 Correct 1 ms 1616 KB Output is correct
18 Correct 1 ms 1616 KB Output is correct
19 Correct 1 ms 1616 KB Output is correct
20 Correct 1 ms 1488 KB Output is correct
21 Correct 1 ms 1872 KB Output is correct
22 Correct 2 ms 1872 KB Output is correct
23 Correct 1 ms 1488 KB Output is correct
24 Correct 4 ms 3792 KB Output is correct
25 Correct 5 ms 2724 KB Output is correct
26 Correct 4 ms 2000 KB Output is correct
27 Correct 7 ms 3900 KB Output is correct
28 Correct 5 ms 3540 KB Output is correct
29 Correct 6 ms 3792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1360 KB Output is correct
2 Correct 1 ms 1488 KB Output is correct
3 Correct 1 ms 1872 KB Output is correct
4 Correct 1 ms 1616 KB Output is correct
5 Correct 1 ms 1872 KB Output is correct
6 Correct 1 ms 1872 KB Output is correct
7 Correct 1 ms 1872 KB Output is correct
8 Correct 1 ms 1488 KB Output is correct
9 Correct 1 ms 1360 KB Output is correct
10 Correct 1 ms 1488 KB Output is correct
11 Correct 1 ms 1488 KB Output is correct
12 Correct 1 ms 1488 KB Output is correct
13 Correct 1 ms 1488 KB Output is correct
14 Correct 1 ms 1616 KB Output is correct
15 Correct 1 ms 1592 KB Output is correct
16 Correct 1 ms 1488 KB Output is correct
17 Correct 1 ms 1616 KB Output is correct
18 Correct 1 ms 1616 KB Output is correct
19 Correct 1 ms 1616 KB Output is correct
20 Correct 1 ms 1488 KB Output is correct
21 Correct 1 ms 1872 KB Output is correct
22 Correct 2 ms 1872 KB Output is correct
23 Correct 1 ms 1488 KB Output is correct
24 Correct 4 ms 3792 KB Output is correct
25 Correct 5 ms 2724 KB Output is correct
26 Correct 4 ms 2000 KB Output is correct
27 Correct 7 ms 3900 KB Output is correct
28 Correct 5 ms 3540 KB Output is correct
29 Correct 6 ms 3792 KB Output is correct
30 Correct 15 ms 3392 KB Output is correct
31 Correct 63 ms 6748 KB Output is correct
32 Correct 15 ms 3204 KB Output is correct
33 Correct 14 ms 2580 KB Output is correct
34 Correct 712 ms 23412 KB Output is correct
35 Correct 870 ms 36636 KB Output is correct
36 Correct 64 ms 4684 KB Output is correct
37 Correct 681 ms 24940 KB Output is correct
38 Correct 869 ms 34536 KB Output is correct
39 Correct 1200 ms 34868 KB Output is correct
40 Correct 745 ms 24588 KB Output is correct
41 Correct 604 ms 23688 KB Output is correct
42 Correct 702 ms 32336 KB Output is correct
43 Correct 1095 ms 30528 KB Output is correct
44 Correct 657 ms 25092 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1360 KB Output is correct
2 Correct 1 ms 1488 KB Output is correct
3 Correct 1 ms 1872 KB Output is correct
4 Correct 1 ms 1616 KB Output is correct
5 Correct 1 ms 1872 KB Output is correct
6 Correct 1 ms 1872 KB Output is correct
7 Correct 1 ms 1872 KB Output is correct
8 Correct 1 ms 1488 KB Output is correct
9 Correct 1 ms 1360 KB Output is correct
10 Correct 1 ms 1488 KB Output is correct
11 Correct 1 ms 1488 KB Output is correct
12 Correct 1 ms 1488 KB Output is correct
13 Correct 1 ms 1488 KB Output is correct
14 Correct 1 ms 1616 KB Output is correct
15 Correct 1 ms 1592 KB Output is correct
16 Correct 1 ms 1488 KB Output is correct
17 Correct 1 ms 1616 KB Output is correct
18 Correct 1 ms 1616 KB Output is correct
19 Correct 1 ms 1616 KB Output is correct
20 Correct 1 ms 1488 KB Output is correct
21 Correct 1 ms 1872 KB Output is correct
22 Correct 2 ms 1872 KB Output is correct
23 Correct 1 ms 1488 KB Output is correct
24 Correct 4 ms 3792 KB Output is correct
25 Correct 5 ms 2724 KB Output is correct
26 Correct 4 ms 2000 KB Output is correct
27 Correct 7 ms 3900 KB Output is correct
28 Correct 5 ms 3540 KB Output is correct
29 Correct 6 ms 3792 KB Output is correct
30 Correct 15 ms 3392 KB Output is correct
31 Correct 63 ms 6748 KB Output is correct
32 Correct 15 ms 3204 KB Output is correct
33 Correct 14 ms 2580 KB Output is correct
34 Correct 712 ms 23412 KB Output is correct
35 Correct 870 ms 36636 KB Output is correct
36 Correct 64 ms 4684 KB Output is correct
37 Correct 681 ms 24940 KB Output is correct
38 Correct 869 ms 34536 KB Output is correct
39 Correct 1200 ms 34868 KB Output is correct
40 Correct 745 ms 24588 KB Output is correct
41 Correct 604 ms 23688 KB Output is correct
42 Correct 702 ms 32336 KB Output is correct
43 Correct 1095 ms 30528 KB Output is correct
44 Correct 657 ms 25092 KB Output is correct
45 Runtime error 12 ms 11952 KB Execution killed with signal 11
46 Halted 0 ms 0 KB -