Submission #825095

# Submission time Handle Problem Language Result Execution time Memory
825095 2023-08-14T14:21:06 Z Marco_Escandon Connecting Supertrees (IOI20_supertrees) C++17
21 / 100
168 ms 24004 KB
    #include "supertrees.h"
    #include <vector>
    #include<bits/stdc++.h>
    using namespace std;
    struct st
    {
        vector<int> cad;
        int findf(int a)
        {
            if(a==cad[a])return a;
            else return cad[a]=findf(cad[a]);
        }
        void unionf(int a, int b){
            a=findf(a);
            b=findf(b);
            if(a!=b){
                cad[a]=b;
            }
        }
        st(int n){
            cad.resize(2*n);
            for(int i=0; i<cad.size(); i++)
                cad[i]=i;
        }
    };
    int construct(std::vector<std::vector<int>> cad) {
    	int n = cad.size();
    	std::vector<std::vector<int>> answer(n,vector<int>(n,0LL));
    	st asdfg(n+1);
    	for(int i=0; i<n; i++)
            for(int j=0; j<n; j++)
                if(cad[i][j]!=0&&i!=j)
                    asdfg.unionf(i,j);
        for(int i=0; i<n; i++)
            for(int j=0; j<n; j++)
                if(cad[i][j]==0&&asdfg.findf(i)==asdfg.findf(j)&&i!=j)
                    return 0;
        st asd(n+1);
    	for(int i=0; i<n; i++)
            for(int j=0; j<n; j++)
                if(cad[i][j]==1&&i!=j)
                    asd.unionf(i,j);
        for(int i=0; i<n; i++)
            for(int j=0; j<n; j++)
            {
                if(cad[i][j]==2&&asd.findf(i)==asd.findf(j)&&i!=j)
                    return 0;
                if(asd.cad[i]==j&&i!=j)
                {
                    answer[i][j]=1;
                    answer[j][i]=1;
                }
                if(cad[i][j]==2&&asd.cad[i]==i&&asd.cad[j]==j)
                {
                    answer[i][j]=1;
                    answer[j][i]=1;
                }
            }
    	build(answer);
    	return 1;
    }

Compilation message

supertrees.cpp: In constructor 'st::st(int)':
supertrees.cpp:23:27: 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<cad.size(); i++)
      |                          ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 7 ms 1236 KB Output is correct
7 Correct 156 ms 23984 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 7 ms 1236 KB Output is correct
7 Correct 156 ms 23984 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 296 KB Output is correct
12 Correct 6 ms 1308 KB Output is correct
13 Correct 147 ms 23996 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 3 ms 852 KB Output is correct
17 Correct 69 ms 13988 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 38 ms 6256 KB Output is correct
21 Correct 151 ms 23936 KB Output is correct
22 Correct 148 ms 23988 KB Output is correct
23 Correct 168 ms 23984 KB Output is correct
24 Correct 148 ms 23936 KB Output is correct
25 Correct 59 ms 14100 KB Output is correct
26 Correct 58 ms 14068 KB Output is correct
27 Correct 157 ms 23924 KB Output is correct
28 Correct 156 ms 23920 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 0 ms 212 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 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 45 ms 6164 KB Output is correct
5 Correct 152 ms 24004 KB Output is correct
6 Correct 164 ms 23952 KB Output is correct
7 Correct 155 ms 23972 KB Output is correct
8 Incorrect 0 ms 212 KB Too many ways to get from 0 to 2, should be 2 found no less than 3
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 7 ms 1236 KB Output is correct
7 Correct 156 ms 23984 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 296 KB Output is correct
12 Correct 6 ms 1308 KB Output is correct
13 Correct 147 ms 23996 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 3 ms 852 KB Output is correct
17 Correct 69 ms 13988 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 38 ms 6256 KB Output is correct
21 Correct 151 ms 23936 KB Output is correct
22 Correct 148 ms 23988 KB Output is correct
23 Correct 168 ms 23984 KB Output is correct
24 Correct 148 ms 23936 KB Output is correct
25 Correct 59 ms 14100 KB Output is correct
26 Correct 58 ms 14068 KB Output is correct
27 Correct 157 ms 23924 KB Output is correct
28 Correct 156 ms 23920 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Incorrect 0 ms 212 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 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 7 ms 1236 KB Output is correct
7 Correct 156 ms 23984 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 296 KB Output is correct
12 Correct 6 ms 1308 KB Output is correct
13 Correct 147 ms 23996 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 3 ms 852 KB Output is correct
17 Correct 69 ms 13988 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 38 ms 6256 KB Output is correct
21 Correct 151 ms 23936 KB Output is correct
22 Correct 148 ms 23988 KB Output is correct
23 Correct 168 ms 23984 KB Output is correct
24 Correct 148 ms 23936 KB Output is correct
25 Correct 59 ms 14100 KB Output is correct
26 Correct 58 ms 14068 KB Output is correct
27 Correct 157 ms 23924 KB Output is correct
28 Correct 156 ms 23920 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Incorrect 0 ms 212 KB Answer gives possible 1 while actual possible 0
33 Halted 0 ms 0 KB -