답안 #926605

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
926605 2024-02-13T12:23:57 Z vjudge1 Party (POI11_imp) C++17
72 / 100
829 ms 65536 KB
    #include <bits/stdc++.h>
    using namespace std;
     
    #define int long long
     
    const int mxN = 5007;
     
    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;
        left.clear();
        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((int)left.size() >= n / 3);
        auto it = left.begin();
        for (int i = 0; i < n / 3; ++i) {
            cout << *it << ' ';
            ++it;
        }
        cout << "\n";
    }
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 604 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 25 ms 3164 KB Output is correct
3 Correct 28 ms 3164 KB Output is correct
4 Correct 27 ms 3160 KB Output is correct
5 Correct 26 ms 3332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 2392 KB Output is correct
2 Correct 112 ms 10216 KB Output is correct
3 Correct 112 ms 10416 KB Output is correct
4 Correct 112 ms 10320 KB Output is correct
5 Correct 108 ms 10320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 3420 KB Output is correct
2 Correct 266 ms 23408 KB Output is correct
3 Correct 281 ms 23292 KB Output is correct
4 Correct 266 ms 23312 KB Output is correct
5 Correct 267 ms 23380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 83 ms 8592 KB Output is correct
2 Correct 378 ms 33716 KB Output is correct
3 Correct 404 ms 34132 KB Output is correct
4 Correct 402 ms 34128 KB Output is correct
5 Correct 393 ms 34408 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 255 ms 24660 KB Output is correct
2 Correct 460 ms 38496 KB Output is correct
3 Correct 500 ms 38080 KB Output is correct
4 Correct 525 ms 38412 KB Output is correct
5 Correct 490 ms 38308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 463 ms 36336 KB Output is correct
2 Correct 627 ms 45372 KB Output is correct
3 Correct 725 ms 45732 KB Output is correct
4 Correct 657 ms 45652 KB Output is correct
5 Correct 660 ms 45484 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 623 ms 43092 KB Output is correct
2 Correct 752 ms 64252 KB Output is correct
3 Correct 823 ms 64336 KB Output is correct
4 Correct 794 ms 62296 KB Output is correct
5 Correct 829 ms 62656 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 744 ms 37904 KB Output is correct
2 Runtime error 367 ms 65536 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 346 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 385 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -