Submission #888216

# Submission time Handle Problem Language Result Execution time Memory
888216 2023-12-16T13:52:57 Z 12345678 Connecting Supertrees (IOI20_supertrees) C++17
46 / 100
189 ms 24148 KB
#include "supertrees.h"
#include <bits/stdc++.h>

using namespace std;

const int nx=1e3+5;
bool vs[nx];

int construct(std::vector<std::vector<int>> p) {
	int n = p.size();
	vector<vector<int>> answer(n, vector<int> (n, 0));
    vector<int> h;
	for (int i=0; i<n; i++)
    {
        if (vs[i]) continue;
        vector<int> d;
        for (int j=0; j<n; j++) if (p[i][j]==1) vs[j]=1, d.push_back(j);
        h.push_back(i);
        int sz=d.size();
        for (int j=0; j<sz-1; j++) answer[d[j]][d[j+1]]=answer[d[j+1]][d[j]]=1;
    }
    for (int i=0; i<n; i++) vs[i]=0;
    for (int i=0; i<h.size(); i++)
    {
        if (vs[i]) continue;
        vector<int> d;
        for (auto j:h) if (p[i][j]) d.push_back(j), vs[j]=1;
        if (d.size()==1) continue;
        int sz=d.size();
        for (int j=0; j<sz-1; j++) answer[d[j]][d[j+1]]=answer[d[j+1]][d[j]]=1;
        answer[d[0]][d[sz-1]]=answer[d[sz-1]][d[0]]=1;
    }
	build(answer);
	return 1;
}

Compilation message

supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:23:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for (int i=0; i<h.size(); i++)
      |                   ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 432 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 6 ms 1372 KB Output is correct
7 Correct 147 ms 23984 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 432 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 6 ms 1372 KB Output is correct
7 Correct 147 ms 23984 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 7 ms 1372 KB Output is correct
13 Correct 173 ms 24144 KB Output is correct
14 Incorrect 1 ms 348 KB Answer gives possible 1 while actual possible 0
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Answer gives possible 1 while actual possible 0
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 39 ms 6272 KB Output is correct
5 Correct 152 ms 24148 KB Output is correct
6 Correct 154 ms 23928 KB Output is correct
7 Correct 189 ms 24060 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 39 ms 6232 KB Output is correct
10 Correct 154 ms 23940 KB Output is correct
11 Correct 180 ms 23948 KB Output is correct
12 Correct 156 ms 23944 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 41 ms 6280 KB Output is correct
17 Correct 157 ms 23936 KB Output is correct
18 Correct 156 ms 24144 KB Output is correct
19 Correct 155 ms 24144 KB Output is correct
20 Correct 156 ms 24144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 432 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 6 ms 1372 KB Output is correct
7 Correct 147 ms 23984 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 7 ms 1372 KB Output is correct
13 Correct 173 ms 24144 KB Output is correct
14 Incorrect 1 ms 348 KB Answer gives possible 1 while actual possible 0
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 432 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 6 ms 1372 KB Output is correct
7 Correct 147 ms 23984 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 7 ms 1372 KB Output is correct
13 Correct 173 ms 24144 KB Output is correct
14 Incorrect 1 ms 348 KB Answer gives possible 1 while actual possible 0
15 Halted 0 ms 0 KB -