Submission #1004276

# Submission time Handle Problem Language Result Execution time Memory
1004276 2024-06-21T07:08:03 Z spensa Connecting Supertrees (IOI20_supertrees) C++17
11 / 100
113 ms 23972 KB
#include "supertrees.h"
#include <vector>
using namespace std;

int construct(std::vector<std::vector<int>> p) {
    //subtask 2: star graph, but as connected components
	int n = p.size();
    vector<vector<int>> ans(n, vector<int> (n));  

    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            ans[i][j] = 0;
        }
    }

    vector<int> flags;
    flags.push_back(0);
    for(int i=1; i<n; i++){
        int tmp = 0;
        for(int j: flags){
            if(p[i][j]==0) continue;
            ans[i][j] = 1;
            ans[j][i] = 1;
            tmp++;
            // break;
        }
        if(tmp>=2) return 0;
        if(tmp==0) flags.push_back(i);
    }

    build(ans);
	return 1;
}
# Verdict Execution time Memory Grader output
1 Correct 1 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 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 4 ms 1372 KB Output is correct
7 Correct 97 ms 23972 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 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 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 4 ms 1372 KB Output is correct
7 Correct 97 ms 23972 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 424 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 4 ms 1328 KB Output is correct
13 Correct 113 ms 23932 KB Output is correct
14 Incorrect 0 ms 344 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 1 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 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 1 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 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 4 ms 1372 KB Output is correct
7 Correct 97 ms 23972 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 424 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 4 ms 1328 KB Output is correct
13 Correct 113 ms 23932 KB Output is correct
14 Incorrect 0 ms 344 KB Answer gives possible 1 while actual possible 0
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 4 ms 1372 KB Output is correct
7 Correct 97 ms 23972 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 424 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 4 ms 1328 KB Output is correct
13 Correct 113 ms 23932 KB Output is correct
14 Incorrect 0 ms 344 KB Answer gives possible 1 while actual possible 0
15 Halted 0 ms 0 KB -