Submission #433754

# Submission time Handle Problem Language Result Execution time Memory
433754 2021-06-20T10:21:35 Z SAAD Connecting Supertrees (IOI20_supertrees) C++17
0 / 100
1 ms 332 KB
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include "supertrees.h"
using namespace std;
int tree[10002], n;
vector <int> te[1006];
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;
                te[i].push_back(j);
            }
        }
    }
    for (int i = 0; i < 1002; i++) {
        if (tree[i] == i && te[i].size() > 1 ) {
            for (int j = 0; j < te[i].size()-1;j++) {
                a[te[i][j]][te[i][j + 1]] = 1;
                a[te[i][j + 1]][te[i][j]] = 1;
            }
            a[te[i][0]][te[i][te[i].size()-1]] = 1;
            a[te[i][te[i].size() - 1]][te[i][0]] = 1;
        }
    }
    build(a);
    return 1;
}

Compilation message

supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:32:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |             for (int j = 0; j < te[i].size()-1;j++) {
      |                             ~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Incorrect 1 ms 332 KB Too many ways to get from 0 to 2, should be 1 found no less than 2
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Incorrect 1 ms 332 KB Too many ways to get from 0 to 2, should be 1 found no less than 2
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 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 332 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 1 ms 332 KB Output is correct
3 Incorrect 1 ms 332 KB Too many ways to get from 0 to 2, should be 1 found no less than 2
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Incorrect 1 ms 332 KB Too many ways to get from 0 to 2, should be 1 found no less than 2
4 Halted 0 ms 0 KB -