답안 #926596

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
926596 2024-02-13T11:58:20 Z haxorman Party (POI11_imp) C++14
72 / 100
805 ms 65536 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long

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);
    }

    for (int u = 1; u <= n; ++u) {
        if (!left.count(u)) {
            continue;
        }

        set<int> check = {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;
            }
        }
    }
    
    assert(left.size() >= n / 3);
    auto it = left.begin();
    for (int i = 0; i < n / 3; ++i) {
        cout << *it << ' ';
        ++it;
    }
    cout << "\n";
}

Compilation message

In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from imp.cpp:1:
imp.cpp: In function 'int32_t main()':
imp.cpp:48:24: warning: comparison of integer expressions of different signedness: 'std::set<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   48 |     assert(left.size() >= n / 3);
      |            ~~~~~~~~~~~~^~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 860 KB Output is correct
2 Correct 26 ms 2900 KB Output is correct
3 Correct 27 ms 2652 KB Output is correct
4 Correct 26 ms 2652 KB Output is correct
5 Correct 27 ms 2652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 1884 KB Output is correct
2 Correct 109 ms 9344 KB Output is correct
3 Correct 111 ms 9296 KB Output is correct
4 Correct 113 ms 9328 KB Output is correct
5 Correct 108 ms 9408 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 36 ms 2648 KB Output is correct
2 Correct 251 ms 21128 KB Output is correct
3 Correct 266 ms 21364 KB Output is correct
4 Correct 291 ms 21072 KB Output is correct
5 Correct 276 ms 21496 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 85 ms 7260 KB Output is correct
2 Correct 370 ms 30848 KB Output is correct
3 Correct 396 ms 30836 KB Output is correct
4 Correct 383 ms 31112 KB Output is correct
5 Correct 414 ms 31212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 249 ms 21328 KB Output is correct
2 Correct 456 ms 34616 KB Output is correct
3 Correct 490 ms 34644 KB Output is correct
4 Correct 490 ms 34676 KB Output is correct
5 Correct 495 ms 34904 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 454 ms 30548 KB Output is correct
2 Correct 614 ms 40460 KB Output is correct
3 Correct 658 ms 40876 KB Output is correct
4 Correct 645 ms 40828 KB Output is correct
5 Correct 646 ms 40788 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 627 ms 34804 KB Output is correct
2 Correct 736 ms 62472 KB Output is correct
3 Correct 791 ms 62568 KB Output is correct
4 Correct 805 ms 62548 KB Output is correct
5 Correct 792 ms 62492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 734 ms 37940 KB Output is correct
2 Runtime error 346 ms 65536 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 331 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 372 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -