답안 #706958

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
706958 2023-03-08T07:35:43 Z socpite CEOI16_icc (CEOI16_icc) C++17
0 / 100
151 ms 262144 KB
#include"icc.h"
#include<bits/stdc++.h>
using namespace std;

#define f first
#define s second

typedef long long ll;
typedef long double ld;

const int maxn = 105;
const int mod = 998244353;
 
int t, n;

int up[maxn];

int Find(int x){
    if(!up[x])return x;
    else return up[x] = Find(up[x]);
}

void Union(int a, int b){
    a = Find(a);
    b = Find(b);
    up[a] = b;
}

int arr1[maxn], arr2[maxn];

int gt(vector<int> a, vector<int> b){
    if(a.empty() || b.empty())return 0;
    for(int i = 0; i < a.size(); i++)arr1[i] = a[i];
    for(int i = 0; i < b.size(); i++)arr2[i] = b[i];
    return query(a.size(), b.size(), arr1, arr2);
}

int bs(vector<int> a, vector<int> b){
    int l = 0, r = a.size();
    while(l < r){
        int mid = (l+r+1)>>1;
        if(gt(vector<int>(a.begin(), a.begin()+mid), b))l = mid-1;
        else r = mid;
    }
    return a[l];
}

void findedge(vector<int> a, vector<int> b){
    int h1 = bs(a, b), h2 = bs(b, a);
    Union(h1, h2);
    setRoad(h1, h2);
}

void run(int N){
    n = N;
    for(int i = 1; i <= n; i++)up[i]=i;
    for(int i = 0; i < n-1; i++){
        for(int j = 0; j < 10; j++){
            vector<int> v[2];
            for(int k = 1; k <= n; k++)v[(Find(k)>>j)&1].push_back(k);
            if(gt(v[0], v[1])){
                findedge(v[0], v[1]);
                break;
            }
        }
    }
}

Compilation message

icc.cpp: In function 'int gt(std::vector<int>, std::vector<int>)':
icc.cpp:33:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |     for(int i = 0; i < a.size(); i++)arr1[i] = a[i];
      |                    ~~^~~~~~~~~~
icc.cpp:34:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |     for(int i = 0; i < b.size(); i++)arr2[i] = b[i];
      |                    ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 143 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 151 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 142 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 145 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 141 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 147 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -