| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 959166 | Ariadna | Geppetto (COCI15_geppetto) | C++14 | 89 ms | 4544 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int pizzas(int n, vector<vector<int>>& mixing) {
    priority_queue<int> pq;
    vector<int> visited(1<<n, 0);
    pq.push(0);
    int ans = 1;
    while (!pq.empty()) {
        int mask = pq.top();
        pq.pop();
        for (int i = 0; i < n; ++i) {
            if (mask & (1<<i) || visited[mask | (1<<i)]) continue;
            bool control = true;
            for (int j = 0; j < n; ++j) {
                if ((mask & (1<<j)) && mixing[i][j]) control = false;
            }
            int new_mask = mask | (1<<i);
            if (control) {
                ++ans;
                pq.push(new_mask);
            }
            visited[new_mask] = 1;
        }
    }
    return ans;
}
int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> mixing(n, vector<int>(n, 0));
    while (m--) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        mixing[a][b] = mixing[b][a] = 1;
    }
    cout << pizzas(n, mixing) << '\n';
    return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
