답안 #926595

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
926595 2024-02-13T11:57:30 Z vjudge1 Party (POI11_imp) C++17
72 / 100
836 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 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 652 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 2700 KB Output is correct
3 Correct 27 ms 2772 KB Output is correct
4 Correct 26 ms 2784 KB Output is correct
5 Correct 27 ms 2748 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 1880 KB Output is correct
2 Correct 108 ms 9384 KB Output is correct
3 Correct 112 ms 9340 KB Output is correct
4 Correct 122 ms 9336 KB Output is correct
5 Correct 114 ms 9408 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 36 ms 2652 KB Output is correct
2 Correct 249 ms 21316 KB Output is correct
3 Correct 287 ms 21320 KB Output is correct
4 Correct 268 ms 21216 KB Output is correct
5 Correct 266 ms 21332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 84 ms 7252 KB Output is correct
2 Correct 384 ms 30820 KB Output is correct
3 Correct 395 ms 31060 KB Output is correct
4 Correct 382 ms 31056 KB Output is correct
5 Correct 427 ms 31424 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 275 ms 21280 KB Output is correct
2 Correct 458 ms 34388 KB Output is correct
3 Correct 490 ms 34528 KB Output is correct
4 Correct 502 ms 34644 KB Output is correct
5 Correct 482 ms 34560 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 491 ms 30112 KB Output is correct
2 Correct 637 ms 40460 KB Output is correct
3 Correct 666 ms 41320 KB Output is correct
4 Correct 654 ms 40520 KB Output is correct
5 Correct 641 ms 40552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 597 ms 34792 KB Output is correct
2 Correct 732 ms 62524 KB Output is correct
3 Correct 836 ms 62380 KB Output is correct
4 Correct 822 ms 62396 KB Output is correct
5 Correct 812 ms 62548 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 733 ms 37700 KB Output is correct
2 Runtime error 348 ms 65536 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 355 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 358 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -