Submission #998385

# Submission time Handle Problem Language Result Execution time Memory
998385 2024-06-13T19:03:07 Z andrei_iorgulescu Newspapers (CEOI21_newspapers) C++14
6 / 100
663 ms 88396 KB
#include <bits/stdc++.h>

using namespace std;

ifstream in("lol.in");
ofstream out("lol.out");

int n;
int m;
vector<int> g[25];
vector<int> gmask[(1 << 20) + 5];
int t[(1 << 20) + 5];

bool pot[(1 << 20) + 5];

void dfs(int mask)
{
    pot[mask] = true;
    for (auto vecin : gmask[mask])
        if (!pot[vecin])
            t[vecin] = mask,dfs(vecin);
}

int main()
{
    cin >> n >> m;
    for (int i = 1; i <= m; i++)
    {
        int x,y;
        cin >> x >> y;
        x--;
        y--;
        g[x].push_back(y);
        g[y].push_back(x);
    }
    if (m != n - 1)
    {
        cout << "NO";
        return 0;
    }
    for (int mask = 1; mask < (1 << n); mask++)
    {
        for (int bit = 0; bit < n; bit++)
        {
            if (mask & (1 << bit))
            {
                bool huh[25];
                for (int i = 0; i < n; i++)
                {
                    if (i == bit or !(mask & (1 << i)))
                        huh[i] = true;
                    else
                        huh[i] = false;
                }
                int new_mask = 0;
                for (int i = 0; i < n; i++)
                {
                    bool iau = false;
                    for (auto vecin : g[i])
                        if (huh[vecin] == false)
                            iau = true;
                    if (iau)
                        new_mask += (1 << i);
                }
                gmask[new_mask].push_back(mask);
            }
        }
    }
    dfs(0);
    if (pot[(1 << n) - 1])
    {
        cout << "YES\n1\n1";
        /*int x = (1 << n) - 1;
        while (x != 0)
        {
            cout << x << endl;
            x = t[x];
        }*/
    }
    else
        cout << "NO";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 27740 KB Output is correct
2 Partially correct 5 ms 27948 KB Failed to provide a successful strategy.
3 Partially correct 5 ms 27880 KB Failed to provide a successful strategy.
4 Partially correct 5 ms 27740 KB Failed to provide a successful strategy.
5 Partially correct 5 ms 27860 KB Failed to provide a successful strategy.
6 Partially correct 6 ms 27740 KB Failed to provide a successful strategy.
7 Correct 5 ms 25692 KB Output is correct
8 Partially correct 5 ms 27740 KB Failed to provide a successful strategy.
9 Correct 5 ms 27864 KB Output is correct
10 Partially correct 5 ms 27740 KB Failed to provide a successful strategy.
11 Partially correct 5 ms 27740 KB Failed to provide a successful strategy.
12 Partially correct 5 ms 27740 KB Failed to provide a successful strategy.
13 Partially correct 4 ms 27740 KB Failed to provide a successful strategy.
14 Partially correct 5 ms 27740 KB Failed to provide a successful strategy.
15 Partially correct 4 ms 27996 KB Failed to provide a successful strategy.
16 Partially correct 5 ms 27996 KB Failed to provide a successful strategy.
17 Partially correct 5 ms 27996 KB Failed to provide a successful strategy.
18 Partially correct 5 ms 27872 KB Failed to provide a successful strategy.
19 Partially correct 5 ms 27872 KB Failed to provide a successful strategy.
20 Partially correct 5 ms 27996 KB Failed to provide a successful strategy.
21 Partially correct 5 ms 27872 KB Failed to provide a successful strategy.
22 Partially correct 5 ms 27996 KB Failed to provide a successful strategy.
23 Partially correct 7 ms 28136 KB Failed to provide a successful strategy.
24 Partially correct 6 ms 27996 KB Failed to provide a successful strategy.
25 Partially correct 6 ms 27996 KB Failed to provide a successful strategy.
26 Partially correct 6 ms 28112 KB Failed to provide a successful strategy.
27 Partially correct 7 ms 28252 KB Failed to provide a successful strategy.
28 Partially correct 7 ms 28132 KB Failed to provide a successful strategy.
29 Correct 7 ms 28252 KB Output is correct
30 Partially correct 7 ms 28252 KB Failed to provide a successful strategy.
31 Partially correct 10 ms 28508 KB Failed to provide a successful strategy.
32 Partially correct 11 ms 28508 KB Failed to provide a successful strategy.
33 Partially correct 10 ms 28508 KB Failed to provide a successful strategy.
34 Correct 9 ms 28628 KB Output is correct
35 Partially correct 17 ms 29272 KB Failed to provide a successful strategy.
36 Partially correct 19 ms 29260 KB Failed to provide a successful strategy.
37 Partially correct 17 ms 29276 KB Failed to provide a successful strategy.
38 Partially correct 18 ms 29276 KB Failed to provide a successful strategy.
39 Partially correct 31 ms 30932 KB Failed to provide a successful strategy.
40 Partially correct 34 ms 30976 KB Failed to provide a successful strategy.
41 Partially correct 31 ms 30720 KB Failed to provide a successful strategy.
42 Partially correct 31 ms 30804 KB Failed to provide a successful strategy.
43 Partially correct 64 ms 34296 KB Failed to provide a successful strategy.
44 Partially correct 63 ms 34128 KB Failed to provide a successful strategy.
45 Correct 61 ms 34128 KB Output is correct
46 Correct 66 ms 34384 KB Output is correct
47 Correct 130 ms 40788 KB Output is correct
48 Partially correct 139 ms 41040 KB Failed to provide a successful strategy.
49 Correct 127 ms 40788 KB Output is correct
50 Correct 132 ms 41300 KB Output is correct
51 Partially correct 279 ms 56216 KB Failed to provide a successful strategy.
52 Correct 280 ms 56704 KB Output is correct
53 Correct 285 ms 56916 KB Output is correct
54 Partially correct 286 ms 54404 KB Failed to provide a successful strategy.
55 Correct 596 ms 85288 KB Output is correct
56 Correct 582 ms 78392 KB Output is correct
57 Correct 663 ms 88396 KB Output is correct
58 Correct 620 ms 84048 KB Output is correct
59 Correct 4 ms 25688 KB Output is correct
60 Correct 4 ms 25692 KB Output is correct
61 Correct 4 ms 25688 KB Output is correct
62 Correct 4 ms 25688 KB Output is correct
63 Correct 4 ms 25692 KB Output is correct
64 Correct 4 ms 25692 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 27736 KB Output is correct
2 Partially correct 4 ms 27740 KB Failed to provide a successful strategy.
3 Partially correct 5 ms 27740 KB Failed to provide a successful strategy.
4 Partially correct 4 ms 27864 KB Failed to provide a successful strategy.
5 Partially correct 5 ms 27740 KB Failed to provide a successful strategy.
6 Partially correct 4 ms 27740 KB Failed to provide a successful strategy.
7 Partially correct 5 ms 27976 KB Failed to provide a successful strategy.
8 Partially correct 5 ms 27740 KB Failed to provide a successful strategy.
9 Partially correct 5 ms 27740 KB Failed to provide a successful strategy.
10 Partially correct 5 ms 28004 KB Failed to provide a successful strategy.
11 Runtime error 21 ms 52056 KB Execution killed with signal 11
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 27740 KB Output is correct
2 Partially correct 5 ms 27948 KB Failed to provide a successful strategy.
3 Partially correct 5 ms 27880 KB Failed to provide a successful strategy.
4 Partially correct 5 ms 27740 KB Failed to provide a successful strategy.
5 Partially correct 5 ms 27860 KB Failed to provide a successful strategy.
6 Partially correct 6 ms 27740 KB Failed to provide a successful strategy.
7 Correct 5 ms 25692 KB Output is correct
8 Partially correct 5 ms 27740 KB Failed to provide a successful strategy.
9 Correct 5 ms 27864 KB Output is correct
10 Partially correct 5 ms 27740 KB Failed to provide a successful strategy.
11 Partially correct 5 ms 27740 KB Failed to provide a successful strategy.
12 Partially correct 5 ms 27740 KB Failed to provide a successful strategy.
13 Partially correct 4 ms 27740 KB Failed to provide a successful strategy.
14 Partially correct 5 ms 27740 KB Failed to provide a successful strategy.
15 Partially correct 4 ms 27996 KB Failed to provide a successful strategy.
16 Partially correct 5 ms 27996 KB Failed to provide a successful strategy.
17 Partially correct 5 ms 27996 KB Failed to provide a successful strategy.
18 Partially correct 5 ms 27872 KB Failed to provide a successful strategy.
19 Partially correct 5 ms 27872 KB Failed to provide a successful strategy.
20 Partially correct 5 ms 27996 KB Failed to provide a successful strategy.
21 Partially correct 5 ms 27872 KB Failed to provide a successful strategy.
22 Partially correct 5 ms 27996 KB Failed to provide a successful strategy.
23 Partially correct 7 ms 28136 KB Failed to provide a successful strategy.
24 Partially correct 6 ms 27996 KB Failed to provide a successful strategy.
25 Partially correct 6 ms 27996 KB Failed to provide a successful strategy.
26 Partially correct 6 ms 28112 KB Failed to provide a successful strategy.
27 Partially correct 7 ms 28252 KB Failed to provide a successful strategy.
28 Partially correct 7 ms 28132 KB Failed to provide a successful strategy.
29 Correct 7 ms 28252 KB Output is correct
30 Partially correct 7 ms 28252 KB Failed to provide a successful strategy.
31 Partially correct 10 ms 28508 KB Failed to provide a successful strategy.
32 Partially correct 11 ms 28508 KB Failed to provide a successful strategy.
33 Partially correct 10 ms 28508 KB Failed to provide a successful strategy.
34 Correct 9 ms 28628 KB Output is correct
35 Partially correct 17 ms 29272 KB Failed to provide a successful strategy.
36 Partially correct 19 ms 29260 KB Failed to provide a successful strategy.
37 Partially correct 17 ms 29276 KB Failed to provide a successful strategy.
38 Partially correct 18 ms 29276 KB Failed to provide a successful strategy.
39 Partially correct 31 ms 30932 KB Failed to provide a successful strategy.
40 Partially correct 34 ms 30976 KB Failed to provide a successful strategy.
41 Partially correct 31 ms 30720 KB Failed to provide a successful strategy.
42 Partially correct 31 ms 30804 KB Failed to provide a successful strategy.
43 Partially correct 64 ms 34296 KB Failed to provide a successful strategy.
44 Partially correct 63 ms 34128 KB Failed to provide a successful strategy.
45 Correct 61 ms 34128 KB Output is correct
46 Correct 66 ms 34384 KB Output is correct
47 Correct 130 ms 40788 KB Output is correct
48 Partially correct 139 ms 41040 KB Failed to provide a successful strategy.
49 Correct 127 ms 40788 KB Output is correct
50 Correct 132 ms 41300 KB Output is correct
51 Partially correct 279 ms 56216 KB Failed to provide a successful strategy.
52 Correct 280 ms 56704 KB Output is correct
53 Correct 285 ms 56916 KB Output is correct
54 Partially correct 286 ms 54404 KB Failed to provide a successful strategy.
55 Correct 596 ms 85288 KB Output is correct
56 Correct 582 ms 78392 KB Output is correct
57 Correct 663 ms 88396 KB Output is correct
58 Correct 620 ms 84048 KB Output is correct
59 Correct 4 ms 25688 KB Output is correct
60 Correct 4 ms 25692 KB Output is correct
61 Correct 4 ms 25688 KB Output is correct
62 Correct 4 ms 25688 KB Output is correct
63 Correct 4 ms 25692 KB Output is correct
64 Correct 4 ms 25692 KB Output is correct
65 Correct 4 ms 27736 KB Output is correct
66 Partially correct 4 ms 27856 KB Failed to provide a successful strategy.
67 Partially correct 4 ms 27740 KB Failed to provide a successful strategy.
68 Partially correct 4 ms 27740 KB Failed to provide a successful strategy.
69 Partially correct 4 ms 27740 KB Failed to provide a successful strategy.
70 Partially correct 5 ms 27740 KB Failed to provide a successful strategy.
71 Correct 4 ms 25792 KB Output is correct
72 Partially correct 6 ms 27740 KB Failed to provide a successful strategy.
73 Correct 5 ms 27996 KB Output is correct
74 Partially correct 5 ms 27740 KB Failed to provide a successful strategy.
75 Partially correct 4 ms 27740 KB Failed to provide a successful strategy.
76 Partially correct 5 ms 27740 KB Failed to provide a successful strategy.
77 Partially correct 5 ms 27740 KB Failed to provide a successful strategy.
78 Partially correct 4 ms 27740 KB Failed to provide a successful strategy.
79 Runtime error 22 ms 52060 KB Execution killed with signal 11
80 Halted 0 ms 0 KB -