답안 #926598

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
926598 2024-02-13T12:01:58 Z haxorman Party (POI11_imp) C++14
72 / 100
813 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;
            }
        }
    }
    
    if (left.size() < n / 3) {
        cout << "gay\n";
        exit(0);
    }
    auto it = left.begin();
    for (int i = 0; i < n / 3; ++i) {
        cout << *it << ' ';
        if (i < n / 3 - 1) {
            ++it;
        }
    }
    cout << "\n";
}

Compilation message

imp.cpp: In function 'int32_t main()':
imp.cpp:48:21: 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 |     if (left.size() < n / 3) {
      |         ~~~~~~~~~~~~^~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 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 2752 KB Output is correct
3 Correct 27 ms 2652 KB Output is correct
4 Correct 27 ms 2652 KB Output is correct
5 Correct 27 ms 2648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 1880 KB Output is correct
2 Correct 106 ms 9296 KB Output is correct
3 Correct 112 ms 9592 KB Output is correct
4 Correct 112 ms 9332 KB Output is correct
5 Correct 110 ms 9404 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 36 ms 2652 KB Output is correct
2 Correct 252 ms 21332 KB Output is correct
3 Correct 282 ms 21436 KB Output is correct
4 Correct 275 ms 21216 KB Output is correct
5 Correct 268 ms 21340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 82 ms 7256 KB Output is correct
2 Correct 373 ms 31056 KB Output is correct
3 Correct 398 ms 30844 KB Output is correct
4 Correct 392 ms 31020 KB Output is correct
5 Correct 392 ms 31060 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 251 ms 21288 KB Output is correct
2 Correct 453 ms 34496 KB Output is correct
3 Correct 501 ms 34392 KB Output is correct
4 Correct 493 ms 34656 KB Output is correct
5 Correct 492 ms 34644 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 466 ms 30548 KB Output is correct
2 Correct 616 ms 40528 KB Output is correct
3 Correct 685 ms 41048 KB Output is correct
4 Correct 654 ms 40952 KB Output is correct
5 Correct 658 ms 40792 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 607 ms 34644 KB Output is correct
2 Correct 758 ms 62392 KB Output is correct
3 Correct 811 ms 62548 KB Output is correct
4 Correct 813 ms 62412 KB Output is correct
5 Correct 785 ms 62492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 731 ms 37684 KB Output is correct
2 Runtime error 363 ms 65536 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 319 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 391 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -