Submission #328610

# Submission time Handle Problem Language Result Execution time Memory
328610 2020-11-17T10:56:41 Z Vladth11 Party (POI11_imp) C++14
0 / 100
2106 ms 65536 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define debug(x) cerr << #x << " " << x << "\n"
#define debug_with_space(x) cerr << #x << " " << x << " "

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair <ll, ll> pii;
typedef pair <ll, pii> piii;
typedef tree <pii, null_type, less <pii>, rb_tree_tag, tree_order_statistics_node_update> OST;

const ll NMAX = 200001;
const ll INF = (1 << 16) - 1;
const ll MOD = 1000000007;
const ll BLOCK = 101;
const ll nr_of_bits = 20;

bitset <3001> b[3001];
vector <int> sol;
vector <int> v[3001];
int ok[3001];
queue <int> q;

int main() {
    int n, m, i;
    cin >> n >> m;
    for(i = 1; i <= m; i++) {
        int x, y;
        cin >> x >> y;
        v[x].push_back(y);
        v[y].push_back(x);
        b[x][y].flip();
        b[y][x].flip();
    }
    for(i = 1; i <= n; i++) {
        ok[i] = 1;
        q.push(i);
    }
    while(!q.empty()) {
        int i = q.front();
        q.pop();
        if(ok[i] == 0)
            continue;
        if(b[i].count() < (n / 3) * 2 - 1) {
            ok[i] = 0;
            for(auto x : v[i]) {
                b[x][i].flip();
                if(b[x].count() < (n / 3) * 2 - 1) {
                    q.push(x);
                }
            }
        }
    }
    int cc = n / 3;
    for(i = 1 ;i <= n && cc; i++){
        if(ok[i]){
            cc--;
            cout << i << " ";
        }
    }
    return 0;
}

Compilation message

imp.cpp: In function 'int main()':
imp.cpp:46:25: warning: comparison of integer expressions of different signedness: 'std::size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   46 |         if(b[i].count() < (n / 3) * 2 - 1) {
      |            ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
imp.cpp:50:33: warning: comparison of integer expressions of different signedness: 'std::size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   50 |                 if(b[x].count() < (n / 3) * 2 - 1) {
      |                    ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 492 KB Nie wszystkie wypisane osoby siê znaja
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 620 KB Output is correct
2 Incorrect 46 ms 2412 KB Nie wszystkie wypisane osoby siê znaja
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 30 ms 1388 KB Output is correct
2 Incorrect 209 ms 8288 KB Nie wszystkie wypisane osoby siê znaja
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 68 ms 1900 KB Output is correct
2 Incorrect 489 ms 19564 KB Nie wszystkie wypisane osoby siê znaja
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 202 ms 4332 KB Output is correct
2 Incorrect 673 ms 27756 KB Nie wszystkie wypisane osoby siê znaja
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 470 ms 12268 KB Output is correct
2 Incorrect 854 ms 32364 KB Nie wszystkie wypisane osoby siê znaja
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 880 ms 16376 KB Output is correct
2 Incorrect 1144 ms 40044 KB Nie wszystkie wypisane osoby siê znaja
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1151 ms 18992 KB Output is correct
2 Incorrect 1359 ms 56172 KB Nie wszystkie wypisane osoby siê znaja
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1375 ms 20588 KB Output is correct
2 Incorrect 1657 ms 63748 KB Nie wszystkie wypisane osoby siê znaja
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1645 ms 37268 KB Output is correct
2 Incorrect 1841 ms 65536 KB Nie wszystkie wypisane osoby siê znaja
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2106 ms 42488 KB Output is correct
2 Incorrect 1994 ms 65536 KB Nie wszystkie wypisane osoby siê znaja
3 Halted 0 ms 0 KB -