Submission #541512

# Submission time Handle Problem Language Result Execution time Memory
541512 2022-03-23T17:15:03 Z adespawn Mousetrap (CEOI17_mousetrap) C++14
25 / 100
776 ms 69516 KB
#include <bits/stdc++.h>
using namespace std;

vector<int> sc[1000006];

long long solve(int w, int f)
{
    priority_queue<int> k;
    for (auto i : sc[w])
    {
        if (i == f)
            continue;
        k.push(solve(i, w));
    }
    while (k.size() < 2)
        k.push(0);
    k.pop();
    return sc[w].size() - 1 + k.top();
}

int main()
{
    ios_base::sync_with_stdio(0);
    int n, m, k;
    cin >> n >> m >> k;
    for (int i = 1; i < n; i++)
    {
        int a, b;
        cin >> a >> b;
        sc[a].push_back(b);
        sc[b].push_back(a);
    }
    cout << solve(k, m);
}
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 23764 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 346 ms 68492 KB Output is correct
2 Correct 299 ms 63920 KB Output is correct
3 Correct 775 ms 69468 KB Output is correct
4 Correct 356 ms 46356 KB Output is correct
5 Correct 770 ms 69408 KB Output is correct
6 Correct 776 ms 69516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 23764 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 23764 KB Output isn't correct
2 Halted 0 ms 0 KB -