Submission #847011

# Submission time Handle Problem Language Result Execution time Memory
847011 2023-09-09T01:33:57 Z 12345678 Connecting Supertrees (IOI20_supertrees) C++17
21 / 100
169 ms 24148 KB
#include "supertrees.h"
#include <bits/stdc++.h>

using namespace std;

const int nx=1e3+5;
int gc;
bool vs[nx];
vector<vector<int>> g(nx);

int construct(std::vector<std::vector<int>> p) {
	int n = p.size();
	vector<vector<int>> answer(n, vector<int> (n));
	for (int i=0; i<n; i++)
    {
        if (!vs[i])
        {
            queue<int> q;
            q.push(i); vs[i]=1;
            while (!q.empty())
            {
                int x=q.front(); q.pop();
                g[gc].push_back(x);
                for (int j=0; j<n; j++) if (p[x][j]&&!vs[j]) q.push(j), vs[j]=1;
            }
            for (auto x:g[gc]) for (auto y:g[gc]) if (p[x][y]==0) return 0;
            for (int j=0; j<g[gc].size()-1; j++) answer[g[gc][j]][g[gc][j+1]]=answer[g[gc][j+1]][g[gc][j]]=1;
            gc++;
        }
    }
	build(answer);
	return 1;
}

Compilation message

supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:27:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |             for (int j=0; j<g[gc].size()-1; j++) answer[g[gc][j]][g[gc][j+1]]=answer[g[gc][j+1]][g[gc][j]]=1;
      |                           ~^~~~~~~~~~~~~~~
# 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 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 7 ms 1312 KB Output is correct
7 Correct 160 ms 22352 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 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 7 ms 1312 KB Output is correct
7 Correct 160 ms 22352 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 600 KB Output is correct
12 Correct 6 ms 1116 KB Output is correct
13 Correct 157 ms 22128 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 4 ms 860 KB Output is correct
17 Correct 78 ms 14164 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 40 ms 6324 KB Output is correct
21 Correct 160 ms 23956 KB Output is correct
22 Correct 155 ms 24148 KB Output is correct
23 Correct 169 ms 24096 KB Output is correct
24 Correct 155 ms 24096 KB Output is correct
25 Correct 69 ms 14160 KB Output is correct
26 Correct 70 ms 14100 KB Output is correct
27 Correct 158 ms 24040 KB Output is correct
28 Correct 154 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 348 KB Output is correct
4 Incorrect 1 ms 344 KB Answer gives possible 1 while actual possible 0
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB Too few ways to get from 0 to 1, should be 2 found 1
3 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 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 7 ms 1312 KB Output is correct
7 Correct 160 ms 22352 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 600 KB Output is correct
12 Correct 6 ms 1116 KB Output is correct
13 Correct 157 ms 22128 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 4 ms 860 KB Output is correct
17 Correct 78 ms 14164 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 40 ms 6324 KB Output is correct
21 Correct 160 ms 23956 KB Output is correct
22 Correct 155 ms 24148 KB Output is correct
23 Correct 169 ms 24096 KB Output is correct
24 Correct 155 ms 24096 KB Output is correct
25 Correct 69 ms 14160 KB Output is correct
26 Correct 70 ms 14100 KB Output is correct
27 Correct 158 ms 24040 KB Output is correct
28 Correct 154 ms 24144 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Incorrect 1 ms 344 KB Answer gives possible 1 while actual possible 0
33 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 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 7 ms 1312 KB Output is correct
7 Correct 160 ms 22352 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 600 KB Output is correct
12 Correct 6 ms 1116 KB Output is correct
13 Correct 157 ms 22128 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 4 ms 860 KB Output is correct
17 Correct 78 ms 14164 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 40 ms 6324 KB Output is correct
21 Correct 160 ms 23956 KB Output is correct
22 Correct 155 ms 24148 KB Output is correct
23 Correct 169 ms 24096 KB Output is correct
24 Correct 155 ms 24096 KB Output is correct
25 Correct 69 ms 14160 KB Output is correct
26 Correct 70 ms 14100 KB Output is correct
27 Correct 158 ms 24040 KB Output is correct
28 Correct 154 ms 24144 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Incorrect 1 ms 344 KB Answer gives possible 1 while actual possible 0
33 Halted 0 ms 0 KB -