## Submission #582302

# Submission time Handle Problem Language Result Execution time Memory
582302 2022-06-23T15:58:16 Z stevancv Bosses (BOI16_bosses) C++14
0 / 100
1 ms 316 KB
```#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define sp ' '
#define en '\n'
#define smin(a, b) a = min(a, b)
#define smax(a, b) a = max(a, b)
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
vector<vector<int>> g(n);
for (int i = 0; i < n; i++) {
int sz; cin >> sz;
while (sz--) {
int x; cin >> x;
x -= 1;
g[x].push_back(i);
}
}
int ans = 1e9;
for (int i = 0; i < n; i++) {
queue<int> q;
vector<int> d(n, 1e9);
d[i] = 0;
q.push(i);
while (!q.empty()) {
int s = q.front();
q.pop();
for (int u : g[s]) {
if (d[u] > d[s] + 1) {
d[u] = d[s] + 1;
q.push(u);
}
}
}
int tr = n;
for (int j = 0; j < n; j++) tr += d[j];
smin(ans, tr);
}
cout << ans << en;
return 0;
}
```

#### Subtask #1 0 / 22.0

# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -

#### Subtask #2 0 / 45.0

# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -

#### Subtask #3 0 / 33.0

# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -