Submission #1048190

# Submission time Handle Problem Language Result Execution time Memory
1048190 2024-08-08T04:43:53 Z 정민찬(#11037) Make them Meet (EGOI24_makethemmeet) C++17
10 / 100
1 ms 604 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;

int N, M;
vector<int> adj[110];
vector<int> g[110];
int vis[110];

void make_tree(int x) {
    vis[x] = 1;
    for (auto &y : adj[x]) {
        if (vis[y]) continue;
        g[x].push_back(y);
        make_tree(y);
    }
}

vector<vector<int>> ans;

void construct(int x) {
    if (g[x].empty()) return;
    for (auto &y : g[x]) {
        construct(y);
    }
    vector<int> qry(N);
    iota(qry.begin(), qry.end(), 1);
    qry[x] = 0;
    for (auto &y : g[x]) qry[y] = 0;
    ans.push_back(qry);
    for (auto &y : g[x]) {
        iota(qry.begin(), qry.end(), 1);
        qry[x] = 0;
        qry[y] = 0;
        ans.push_back(qry);
        ans.push_back(qry);
    }
}

int main() {
    ios_base :: sync_with_stdio(false); cin.tie(NULL);
    cin >> N >> M;
    for (int i=0; i<M; i++) {
        int u, v;
        cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    make_tree(0);
    construct(0);
    cout << ans.size() << '\n';
    for (int i=0; i<ans.size(); i++) {
        for (int j=0; j<N; j++) {
            cout << ans[i][j] << ' ';
        }
        cout << '\n';
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:55:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |     for (int i=0; i<ans.size(); i++) {
      |                   ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB If people start at 0 and 1, then they can avoid each other
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 1 ms 348 KB If people start at 0 and 1, then they can avoid each other
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Incorrect 1 ms 348 KB If people start at 0 and 1, then they can avoid each other
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB If people start at 0 and 1, then they can avoid each other
8 Halted 0 ms 0 KB -