Submission #328603

# Submission time Handle Problem Language Result Execution time Memory
328603 2020-11-17T10:27:57 Z Vladth11 Party (POI11_imp) C++14
0 / 100
3000 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 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();
    }
    while(1){
        int nod = rand() % (n - 1) + 1;
        int cnt = 1;
        sol.clear();
        sol.push_back(nod);
        while(cnt < (n / 3)){
            for(auto x : v[nod]){
                if((b[nod] & b[x]).count() >= 2 * (n / 3) - 2){
                    nod = x;
                    sol.push_back(x);
                    cnt++;
                    break;
                }
            }
            break;
        }
        if(cnt == n / 3)
        {
            sort(sol.begin(), sol.end());
            for(auto x : sol){
                cout << x << " ";
            }
            return 0;
        }
    }
    return 0;
}

Compilation message

imp.cpp: In function 'int main()':
imp.cpp:43:44: warning: comparison of integer expressions of different signedness: 'std::size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   43 |                 if((b[nod] & b[x]).count() >= 2 * (n / 3) - 2){
      |                    ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Execution timed out 3098 ms 452 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3095 ms 748 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3029 ms 1792 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3089 ms 2796 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3075 ms 6252 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3065 ms 18924 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3043 ms 28104 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3033 ms 34684 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3092 ms 39352 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3086 ms 59884 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3070 ms 65536 KB Time limit exceeded
2 Halted 0 ms 0 KB -