답안 #926597

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
926597 2024-02-13T12:00:10 Z haxorman Party (POI11_imp) C++14
72 / 100
859 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 << ' ';
        if (i < n / 3 - 1) {
            ++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 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 600 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 25 ms 2756 KB Output is correct
3 Correct 29 ms 2652 KB Output is correct
4 Correct 26 ms 2648 KB Output is correct
5 Correct 27 ms 2652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 2100 KB Output is correct
2 Correct 106 ms 9300 KB Output is correct
3 Correct 114 ms 9300 KB Output is correct
4 Correct 110 ms 9296 KB Output is correct
5 Correct 110 ms 9296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 2652 KB Output is correct
2 Correct 249 ms 21208 KB Output is correct
3 Correct 271 ms 21332 KB Output is correct
4 Correct 271 ms 21072 KB Output is correct
5 Correct 267 ms 21420 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 82 ms 7248 KB Output is correct
2 Correct 368 ms 30820 KB Output is correct
3 Correct 402 ms 30800 KB Output is correct
4 Correct 389 ms 31068 KB Output is correct
5 Correct 394 ms 31324 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 252 ms 21052 KB Output is correct
2 Correct 457 ms 34392 KB Output is correct
3 Correct 503 ms 34536 KB Output is correct
4 Correct 492 ms 34860 KB Output is correct
5 Correct 488 ms 34680 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 462 ms 30328 KB Output is correct
2 Correct 615 ms 40676 KB Output is correct
3 Correct 673 ms 41044 KB Output is correct
4 Correct 662 ms 40736 KB Output is correct
5 Correct 651 ms 40804 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 675 ms 34896 KB Output is correct
2 Correct 758 ms 62632 KB Output is correct
3 Correct 820 ms 62544 KB Output is correct
4 Correct 859 ms 62544 KB Output is correct
5 Correct 812 ms 62488 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 732 ms 37688 KB Output is correct
2 Runtime error 369 ms 65536 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 332 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 380 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -