# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
949962 | 2024-03-20T01:28:08 Z | irmuun | Connecting Supertrees (IOI20_supertrees) | C++17 | 172 ms | 24108 KB |
#include<bits/stdc++.h> #include "supertrees.h" using namespace std; #define ll long long #define pb push_back #define ff first #define ss second #define all(s) s.begin(),s.end() #define rall(s) s.rbegin(),s.rend() int construct(vector<vector<int>>p){ int n=p.size(); vector<vector<int>>b(n,vector<int>(n,0)); vector<bool>used(n,0); vector<int>ver; for(int i=0;i<n;i++){ if(!used[i]){ queue<int>q; q.push(i); used[i]=true; while(!q.empty()){ int x=q.front(); ver.pb(x); q.pop(); for(int j=0;j<n;j++){ if(p[x][j]==1&&!used[j]){ used[j]=true; q.push(j); } } } for(auto x:ver){ for(auto y:ver){ if(x!=y&&p[x][y]!=1){ return 0; } } } for(int j=1;j<ver.size();j++){ b[ver[j]][ver[j-1]]=1; b[ver[j-1]][ver[j]]=1; } ver.clear(); } } build(b); return 1; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 344 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 | 7 ms | 1372 KB | Output is correct |
7 | Correct | 172 ms | 24108 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 344 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 | 7 ms | 1372 KB | Output is correct |
7 | Correct | 172 ms | 24108 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 344 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 348 KB | Output is correct |
12 | Correct | 7 ms | 1176 KB | Output is correct |
13 | Correct | 155 ms | 23928 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 4 ms | 860 KB | Output is correct |
17 | Correct | 85 ms | 14088 KB | Output is correct |
18 | Correct | 0 ms | 600 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 38 ms | 6308 KB | Output is correct |
21 | Correct | 149 ms | 23892 KB | Output is correct |
22 | Correct | 151 ms | 23944 KB | Output is correct |
23 | Correct | 158 ms | 23928 KB | Output is correct |
24 | Correct | 152 ms | 24084 KB | Output is correct |
25 | Correct | 63 ms | 14164 KB | Output is correct |
26 | Correct | 62 ms | 14212 KB | Output is correct |
27 | Correct | 153 ms | 24092 KB | Output is correct |
28 | Correct | 153 ms | 23924 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 1 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 | 344 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Too few ways to get from 0 to 1, should be 2 found 0 |
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 | 344 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 | 7 ms | 1372 KB | Output is correct |
7 | Correct | 172 ms | 24108 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 344 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 348 KB | Output is correct |
12 | Correct | 7 ms | 1176 KB | Output is correct |
13 | Correct | 155 ms | 23928 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 4 ms | 860 KB | Output is correct |
17 | Correct | 85 ms | 14088 KB | Output is correct |
18 | Correct | 0 ms | 600 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 38 ms | 6308 KB | Output is correct |
21 | Correct | 149 ms | 23892 KB | Output is correct |
22 | Correct | 151 ms | 23944 KB | Output is correct |
23 | Correct | 158 ms | 23928 KB | Output is correct |
24 | Correct | 152 ms | 24084 KB | Output is correct |
25 | Correct | 63 ms | 14164 KB | Output is correct |
26 | Correct | 62 ms | 14212 KB | Output is correct |
27 | Correct | 153 ms | 24092 KB | Output is correct |
28 | Correct | 153 ms | 23924 KB | Output is correct |
29 | Correct | 1 ms | 344 KB | Output is correct |
30 | Correct | 1 ms | 344 KB | Output is correct |
31 | Correct | 1 ms | 344 KB | Output is correct |
32 | Incorrect | 0 ms | 348 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 | 344 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 | 7 ms | 1372 KB | Output is correct |
7 | Correct | 172 ms | 24108 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 344 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 348 KB | Output is correct |
12 | Correct | 7 ms | 1176 KB | Output is correct |
13 | Correct | 155 ms | 23928 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 4 ms | 860 KB | Output is correct |
17 | Correct | 85 ms | 14088 KB | Output is correct |
18 | Correct | 0 ms | 600 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 38 ms | 6308 KB | Output is correct |
21 | Correct | 149 ms | 23892 KB | Output is correct |
22 | Correct | 151 ms | 23944 KB | Output is correct |
23 | Correct | 158 ms | 23928 KB | Output is correct |
24 | Correct | 152 ms | 24084 KB | Output is correct |
25 | Correct | 63 ms | 14164 KB | Output is correct |
26 | Correct | 62 ms | 14212 KB | Output is correct |
27 | Correct | 153 ms | 24092 KB | Output is correct |
28 | Correct | 153 ms | 23924 KB | Output is correct |
29 | Correct | 1 ms | 344 KB | Output is correct |
30 | Correct | 1 ms | 344 KB | Output is correct |
31 | Correct | 1 ms | 344 KB | Output is correct |
32 | Incorrect | 0 ms | 348 KB | Answer gives possible 1 while actual possible 0 |
33 | Halted | 0 ms | 0 KB | - |