# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
300230 | 2020-09-17T01:52:19 Z | daniel920712 | Connecting Supertrees (IOI20_supertrees) | C++14 | 1000 ms | 1965544 KB |
#include "supertrees.h" #include <vector> using namespace std; vector < int > how[1005]; int Father[1005]; int Find(int here) { if(Father[here]==here) return here; Father[here]=Find(Father[here]); return here; } int construct(vector< vector<int> > p) { int n=p.size(),i,j,m; vector< vector<int> > answer; vector< int > row; for(int i=0;i<n;i++) row.push_back(0); for(int i=0;i<n;i++) { answer.push_back(row); Father[i]=i; } for(int i=0;i<n;i++) { for(j=0;j<n;j++) { if(p[i][j]==0&&Find(i)==Find(j)) return 0; Father[Find(i)]=Find(j); } } for(int i=0;i<n;i++) how[Find(i)].push_back(i); for(int i=0;i<n;i++) { m=how[i].size(); if(m<=1) continue; for(j=1;j<m;j++) { answer[how[i][j-1]][how[i][j]]=1; answer[how[i][j]][how[i][j-1]]=1; } if(p[how[i][0]][how[i][1]]==2) { if(m==2) return 0; answer[how[i][m-1]][how[i][j]]=1; answer[how[i][j]][how[i][m-1]]=1; } } build(answer); return 1; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Execution timed out | 1192 ms | 1932448 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Execution timed out | 1192 ms | 1932448 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1212 ms | 1965544 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1190 ms | 1945828 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Execution timed out | 1192 ms | 1932448 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Execution timed out | 1192 ms | 1932448 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |