답안 #926612

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
926612 2024-02-13T12:31:56 Z haxorman Party (POI11_imp) C++14
100 / 100
1221 ms 42264 KB
#include <bits/stdc++.h>
using namespace std;

const int mxN = 3007;

vector<int> g[mxN];

int32_t main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int n, m;
    cin >> n >> m;

    for (int i = 0; i < m; ++i) {
        int u, v;
        cin >> u >> v;

        g[u].push_back(v);
        g[v].push_back(u);
    }
    
    set<int> left;
    for (int u = 1; u <= n; ++u) {
        left.insert(u);
    }

    set<int> check;
    for (int u = 1; u <= n; ++u) {
        if (!left.count(u)) {
            continue;
        }
        
        check.insert(u);
        for (auto v : g[u]) {
            check.insert(v);
        }

        for (int v = 1; v <= n; ++v) {
            if (!check.count(v) && left.count(v)) {
                left.erase(u);
                left.erase(v);
                break;
            }
        }
        check.clear();
    }
    
    auto it = left.begin();
    for (int i = 0; i < n / 3; ++i) {
        cout << *it << ' ';
        if (i < n / 3 - 1) {
            ++it;
        }
    }
    cout << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 600 KB Output is correct
2 Correct 27 ms 1628 KB Output is correct
3 Correct 27 ms 1624 KB Output is correct
4 Correct 26 ms 1628 KB Output is correct
5 Correct 33 ms 1628 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 1112 KB Output is correct
2 Correct 102 ms 4776 KB Output is correct
3 Correct 112 ms 4692 KB Output is correct
4 Correct 109 ms 4940 KB Output is correct
5 Correct 111 ms 4804 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 1708 KB Output is correct
2 Correct 243 ms 11604 KB Output is correct
3 Correct 263 ms 11748 KB Output is correct
4 Correct 260 ms 11528 KB Output is correct
5 Correct 263 ms 11596 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 81 ms 3928 KB Output is correct
2 Correct 383 ms 16336 KB Output is correct
3 Correct 396 ms 16328 KB Output is correct
4 Correct 380 ms 16320 KB Output is correct
5 Correct 387 ms 16192 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 248 ms 11836 KB Output is correct
2 Correct 485 ms 18052 KB Output is correct
3 Correct 488 ms 18220 KB Output is correct
4 Correct 483 ms 18032 KB Output is correct
5 Correct 490 ms 18180 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 457 ms 15448 KB Output is correct
2 Correct 641 ms 20748 KB Output is correct
3 Correct 666 ms 20676 KB Output is correct
4 Correct 639 ms 20692 KB Output is correct
5 Correct 642 ms 20816 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 601 ms 17488 KB Output is correct
2 Correct 750 ms 33392 KB Output is correct
3 Correct 791 ms 33348 KB Output is correct
4 Correct 779 ms 33196 KB Output is correct
5 Correct 780 ms 33680 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 730 ms 19232 KB Output is correct
2 Correct 856 ms 36660 KB Output is correct
3 Correct 944 ms 36600 KB Output is correct
4 Correct 906 ms 36820 KB Output is correct
5 Correct 908 ms 36644 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 870 ms 36008 KB Output is correct
2 Correct 1046 ms 39916 KB Output is correct
3 Correct 1109 ms 39936 KB Output is correct
4 Correct 1093 ms 40276 KB Output is correct
5 Correct 1064 ms 40348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1130 ms 41300 KB Output is correct
2 Correct 1092 ms 41892 KB Output is correct
3 Correct 1221 ms 42064 KB Output is correct
4 Correct 1187 ms 42264 KB Output is correct
5 Correct 1149 ms 41924 KB Output is correct