Submission #1030964

# Submission time Handle Problem Language Result Execution time Memory
1030964 2024-07-22T12:57:58 Z thinknoexit Viruses (BOI20_viruses) C++17
0 / 100
2 ms 348 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 111;
const ll INF = 1e9;
vector<int> adj[N];
vector<vector<int>> mu[N];
int deg[N];
ll dp[N];
int main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    int g, n, m;
    cin >> g >> n >> m;
    for (int i = 1;i <= n;i++) {
        int a, k;
        cin >> a >> k;
        vector<int> mut(k);
        for (auto& x : mut) cin >> x;
        mu[a].push_back(mut);
    }
    for (int i = 2;i < g;i++) dp[i] = INF;
    dp[0] = dp[1] = 1;
    for (int _ = 1;_ <= g * g;_++) {
        for (int i = 2;i < g;i++) {
            for (auto& x : mu[i]) {
                ll res = 0;
                for (auto& y : x) res += dp[y];
                dp[i] = min(dp[i], res);
            }
        }
    }
    for (int i = 2;i < g;i++) {
        if (dp[i] >= INF) cout << "YES\n";
        else cout << "NO " << dp[i] << '\n';
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -