답안 #328604

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
328604 2020-11-17T10:28:54 Z Vladth11 Party (POI11_imp) C++14
0 / 100
3000 ms 47448 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() >= (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() >= (n / 3) - 2){
      |                    ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3068 ms 384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3071 ms 620 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3033 ms 1260 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3079 ms 1772 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3088 ms 4204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3079 ms 12356 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3017 ms 16068 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3046 ms 18540 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3095 ms 19948 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3097 ms 37268 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3062 ms 47448 KB Time limit exceeded
2 Halted 0 ms 0 KB -