Submission #433609

# Submission time Handle Problem Language Result Execution time Memory
433609 2021-06-20T08:25:41 Z SAAD Connecting Supertrees (IOI20_supertrees) C++17
21 / 100
241 ms 22152 KB
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include "supertrees.h"
using namespace std;
int tree[10002], n;
int construct(vector<vector<int>> p) {
    n = (int)p.size();
    vector <int> s(n);
    vector<vector<int>> a;
    a = p;
    for (auto&i:a[0]) i = 0;
    memset(tree, -1, sizeof(tree));
    for (int i = 0; i < n; i++) {
        a[i] = a[0];
        if (tree[i] != -1) {
            if (p[i] != p[tree[i]]) return 0;
            continue;
        }
        for (int j = 0; j < n; j++) {
            if (p[i][j]) {
                tree[j] = i;
            }
        }
    }
    for (int i = 0; i < n; i++) {
        if (tree[i] == i) {
            a[i] = p[i];
            a[i][i] = 0;
        }
        else {
            a[i][tree[i]] = 1;
        }
    }
    build(a);
    return 1;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 10 ms 1228 KB Output is correct
7 Correct 225 ms 22016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 10 ms 1228 KB Output is correct
7 Correct 225 ms 22016 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 9 ms 1168 KB Output is correct
13 Correct 241 ms 22152 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 4 ms 716 KB Output is correct
17 Correct 98 ms 12160 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 70 ms 5724 KB Output is correct
21 Correct 223 ms 22024 KB Output is correct
22 Correct 217 ms 22028 KB Output is correct
23 Correct 235 ms 22028 KB Output is correct
24 Correct 226 ms 22140 KB Output is correct
25 Correct 119 ms 12172 KB Output is correct
26 Correct 91 ms 12160 KB Output is correct
27 Correct 227 ms 22068 KB Output is correct
28 Correct 234 ms 22084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Incorrect 1 ms 332 KB Answer gives possible 0 while actual possible 1
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 332 KB Answer gives possible 0 while actual possible 1
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 10 ms 1228 KB Output is correct
7 Correct 225 ms 22016 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 9 ms 1168 KB Output is correct
13 Correct 241 ms 22152 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 4 ms 716 KB Output is correct
17 Correct 98 ms 12160 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 70 ms 5724 KB Output is correct
21 Correct 223 ms 22024 KB Output is correct
22 Correct 217 ms 22028 KB Output is correct
23 Correct 235 ms 22028 KB Output is correct
24 Correct 226 ms 22140 KB Output is correct
25 Correct 119 ms 12172 KB Output is correct
26 Correct 91 ms 12160 KB Output is correct
27 Correct 227 ms 22068 KB Output is correct
28 Correct 234 ms 22084 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 1 ms 332 KB Output is correct
32 Correct 0 ms 332 KB Output is correct
33 Incorrect 1 ms 332 KB Answer gives possible 0 while actual possible 1
34 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 10 ms 1228 KB Output is correct
7 Correct 225 ms 22016 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 9 ms 1168 KB Output is correct
13 Correct 241 ms 22152 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 4 ms 716 KB Output is correct
17 Correct 98 ms 12160 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 70 ms 5724 KB Output is correct
21 Correct 223 ms 22024 KB Output is correct
22 Correct 217 ms 22028 KB Output is correct
23 Correct 235 ms 22028 KB Output is correct
24 Correct 226 ms 22140 KB Output is correct
25 Correct 119 ms 12172 KB Output is correct
26 Correct 91 ms 12160 KB Output is correct
27 Correct 227 ms 22068 KB Output is correct
28 Correct 234 ms 22084 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 1 ms 332 KB Output is correct
32 Correct 0 ms 332 KB Output is correct
33 Incorrect 1 ms 332 KB Answer gives possible 0 while actual possible 1
34 Halted 0 ms 0 KB -