# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
800475 | 2023-08-01T15:17:49 Z | APROHACK | Connecting Supertrees (IOI20_supertrees) | C++17 | 227 ms | 28096 KB |
#include "supertrees.h" #include <bits/stdc++.h> #define ll long long #define ff first #define ss second #define pb push_back using namespace std; vector<vector<int>>P; bool vis[1003]; int n; int construct(std::vector<std::vector<int>> p) { n = p.size(); P = p; memset(vis, false, sizeof vis); vector<std::vector<int>> answer; vector<int> row; for(int j = 0 ; j < n ; j ++)row.pb(0); for (int i = 0; i < n; i++) { answer.push_back(row); } bool isInG[n+1]; memset(isInG, false, sizeof isInG); for(int i = 0 ; i < n ; i ++){ if(vis[i])continue; set<int>grupo1; for(int j = 0 ; j < n ; j ++){ if(p[i][j] == 1){ grupo1.insert(j); isInG[j] = true; } } vector<int>g; for(auto j :grupo1){ g.pb(j); } for(auto j : g){ for(int x = 0 ; x < n ; x ++){ if(p[j][x] == 1 and !isInG[x])return 0; if(p[j][x] == 0 and isInG[x])return 0; } } for(auto j : g){ isInG[j] = false; vis[j] = true; } for(int j = 1 ; j < g.size() ; j ++){ answer[g[j-1]][g[j]] = 1; answer[g[j]][g[j-1]] = 1; } } build(answer); return 1; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 296 KB | Output is correct |
3 | Correct | 1 ms | 300 KB | Output is correct |
4 | Correct | 1 ms | 300 KB | Output is correct |
5 | Correct | 1 ms | 296 KB | Output is correct |
6 | Correct | 7 ms | 1440 KB | Output is correct |
7 | Correct | 227 ms | 27856 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 296 KB | Output is correct |
3 | Correct | 1 ms | 300 KB | Output is correct |
4 | Correct | 1 ms | 300 KB | Output is correct |
5 | Correct | 1 ms | 296 KB | Output is correct |
6 | Correct | 7 ms | 1440 KB | Output is correct |
7 | Correct | 227 ms | 27856 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 300 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 7 ms | 1396 KB | Output is correct |
13 | Correct | 180 ms | 27912 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 3 ms | 980 KB | Output is correct |
17 | Correct | 66 ms | 18048 KB | Output is correct |
18 | Correct | 1 ms | 212 KB | Output is correct |
19 | Correct | 1 ms | 212 KB | Output is correct |
20 | Correct | 39 ms | 7248 KB | Output is correct |
21 | Correct | 170 ms | 27888 KB | Output is correct |
22 | Correct | 153 ms | 27884 KB | Output is correct |
23 | Correct | 165 ms | 27892 KB | Output is correct |
24 | Correct | 152 ms | 27904 KB | Output is correct |
25 | Correct | 74 ms | 17996 KB | Output is correct |
26 | Correct | 61 ms | 18032 KB | Output is correct |
27 | Correct | 168 ms | 28096 KB | Output is correct |
28 | Correct | 154 ms | 27968 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 300 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Incorrect | 1 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 | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 212 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 | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 296 KB | Output is correct |
3 | Correct | 1 ms | 300 KB | Output is correct |
4 | Correct | 1 ms | 300 KB | Output is correct |
5 | Correct | 1 ms | 296 KB | Output is correct |
6 | Correct | 7 ms | 1440 KB | Output is correct |
7 | Correct | 227 ms | 27856 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 300 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 7 ms | 1396 KB | Output is correct |
13 | Correct | 180 ms | 27912 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 3 ms | 980 KB | Output is correct |
17 | Correct | 66 ms | 18048 KB | Output is correct |
18 | Correct | 1 ms | 212 KB | Output is correct |
19 | Correct | 1 ms | 212 KB | Output is correct |
20 | Correct | 39 ms | 7248 KB | Output is correct |
21 | Correct | 170 ms | 27888 KB | Output is correct |
22 | Correct | 153 ms | 27884 KB | Output is correct |
23 | Correct | 165 ms | 27892 KB | Output is correct |
24 | Correct | 152 ms | 27904 KB | Output is correct |
25 | Correct | 74 ms | 17996 KB | Output is correct |
26 | Correct | 61 ms | 18032 KB | Output is correct |
27 | Correct | 168 ms | 28096 KB | Output is correct |
28 | Correct | 154 ms | 27968 KB | Output is correct |
29 | Correct | 1 ms | 212 KB | Output is correct |
30 | Correct | 0 ms | 300 KB | Output is correct |
31 | Correct | 1 ms | 212 KB | Output is correct |
32 | Incorrect | 1 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 | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 296 KB | Output is correct |
3 | Correct | 1 ms | 300 KB | Output is correct |
4 | Correct | 1 ms | 300 KB | Output is correct |
5 | Correct | 1 ms | 296 KB | Output is correct |
6 | Correct | 7 ms | 1440 KB | Output is correct |
7 | Correct | 227 ms | 27856 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 300 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 7 ms | 1396 KB | Output is correct |
13 | Correct | 180 ms | 27912 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 3 ms | 980 KB | Output is correct |
17 | Correct | 66 ms | 18048 KB | Output is correct |
18 | Correct | 1 ms | 212 KB | Output is correct |
19 | Correct | 1 ms | 212 KB | Output is correct |
20 | Correct | 39 ms | 7248 KB | Output is correct |
21 | Correct | 170 ms | 27888 KB | Output is correct |
22 | Correct | 153 ms | 27884 KB | Output is correct |
23 | Correct | 165 ms | 27892 KB | Output is correct |
24 | Correct | 152 ms | 27904 KB | Output is correct |
25 | Correct | 74 ms | 17996 KB | Output is correct |
26 | Correct | 61 ms | 18032 KB | Output is correct |
27 | Correct | 168 ms | 28096 KB | Output is correct |
28 | Correct | 154 ms | 27968 KB | Output is correct |
29 | Correct | 1 ms | 212 KB | Output is correct |
30 | Correct | 0 ms | 300 KB | Output is correct |
31 | Correct | 1 ms | 212 KB | Output is correct |
32 | Incorrect | 1 ms | 212 KB | Answer gives possible 1 while actual possible 0 |
33 | Halted | 0 ms | 0 KB | - |