Submission #919419

#TimeUsernameProblemLanguageResultExecution timeMemory
919419nasir_bashirovICC (CEOI16_icc)C++11
0 / 100
234 ms848 KiB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")

#include <bits/stdc++.h>
#include "icc.h"
using namespace std;

#define db long double
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
// #define endl '\n'
#define all(x) x.begin(), x.end()
#define fastio\
    ios_base::sync_with_stdio(0);\
    cin.tie(0);\
    cout.tie(0)\

// #define int long long

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

int n, par[105];
vi v[105];

void Union(int x, int y){
    if(v[par[x]].size() < v[par[y]].size()) swap(x, y);
    for(int i : v[par[y]]){
        v[par[x]].push_back(i);
    }
    par[y] = par[x];
}

void run(int N){
    n = N;
    for(int i = 1; i <= n; i++){
        v[i].push_back(i);
    }
    for(int t = 1; t < n; t++){
        bool f = false;
        for(int i = 1; i <= n and !f; i++){
            vector<bool> used(n + 5, false);
            for(int j : v[i]){
                used[j] = true;
            }
            for(int j = 1; j <= n; j++){
                if(used[j]) continue;
                int a[] = {i}, b[] = {j};
                if(query(1, 1, a, b)){
                    f = true;
                    setRoad(i, j);
                    Union(i, j);
                }
            }
        }
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...