Submission #953739

# Submission time Handle Problem Language Result Execution time Memory
953739 2024-03-26T15:18:33 Z Trisanu_Das Connecting Supertrees (IOI20_supertrees) C++17
0 / 100
1000 ms 14160 KB
#include <bits/stdc++.h>
using namespace std;
#include "supertrees.h"
 
int n, par[1005];
 
int find(int u){
  return (par[u] == u ? u : find(par[u]));
}
 
void union_(int u, int v){
  par[find(u)] = find(v);
}
 
int construct(vector<vector<int> > p){
  n = p.size();
  for(int i = 0; i < n; i++) par[i] = i;
  vector<vector<int> > b(n, vector<int>(n));
  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++){
      if(p[i][j] && find(i) != find(j)){
        union_(i, j);
        b[i][j] = b[j][i] = 1;
      }else if(!p[i][j] && find(i) == find(j)) return 0;
    }
  }
  build(b);
  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 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 24 ms 1252 KB Output is correct
7 Execution timed out 1025 ms 14160 KB Time limit exceeded
8 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 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 24 ms 1252 KB Output is correct
7 Execution timed out 1025 ms 14160 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 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 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 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 24 ms 1252 KB Output is correct
7 Execution timed out 1025 ms 14160 KB Time limit exceeded
8 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 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 24 ms 1252 KB Output is correct
7 Execution timed out 1025 ms 14160 KB Time limit exceeded
8 Halted 0 ms 0 KB -