Submission #926603

# Submission time Handle Problem Language Result Execution time Memory
926603 2024-02-13T12:11:13 Z haxorman Party (POI11_imp) C++14
72 / 100
903 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);
    }

    set<int> check;
    for (int u = 1; u <= n; ++u) {
        if (!left.count(u)) {
            continue;
        }
        
        check.insert(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;
            }
        }
        check.clear();
    }
    
    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:50: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]
   50 |     if (left.size() < n / 3) {
      |         ~~~~~~~~~~~~^~~~~~~
# Verdict Execution time Memory 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
# Verdict Execution time Memory Grader output
1 Correct 4 ms 860 KB Output is correct
2 Correct 26 ms 3160 KB Output is correct
3 Correct 28 ms 3160 KB Output is correct
4 Correct 27 ms 3160 KB Output is correct
5 Correct 26 ms 3160 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 1884 KB Output is correct
2 Correct 106 ms 11064 KB Output is correct
3 Correct 115 ms 11088 KB Output is correct
4 Correct 111 ms 11088 KB Output is correct
5 Correct 112 ms 11092 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 2652 KB Output is correct
2 Correct 257 ms 25164 KB Output is correct
3 Correct 269 ms 25168 KB Output is correct
4 Correct 277 ms 25324 KB Output is correct
5 Correct 268 ms 25168 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 86 ms 7260 KB Output is correct
2 Correct 381 ms 36448 KB Output is correct
3 Correct 417 ms 36468 KB Output is correct
4 Correct 413 ms 36852 KB Output is correct
5 Correct 398 ms 36692 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 255 ms 21128 KB Output is correct
2 Correct 473 ms 41848 KB Output is correct
3 Correct 511 ms 41444 KB Output is correct
4 Correct 536 ms 41808 KB Output is correct
5 Correct 503 ms 41592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 455 ms 30568 KB Output is correct
2 Correct 633 ms 49692 KB Output is correct
3 Correct 676 ms 50040 KB Output is correct
4 Correct 711 ms 50004 KB Output is correct
5 Correct 679 ms 50048 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 630 ms 34804 KB Output is correct
2 Correct 764 ms 65536 KB Output is correct
3 Correct 804 ms 65536 KB Output is correct
4 Correct 903 ms 65536 KB Output is correct
5 Correct 822 ms 65536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 735 ms 47164 KB Output is correct
2 Runtime error 389 ms 65536 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 365 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 413 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -