답안 #336499

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
336499 2020-12-15T13:01:42 Z mehrdad_sohrabi 항공 노선도 (JOI18_airline) C++14
컴파일 오류
0 ms 0 KB
#include "Alicelib.h"
#include <vector>
 
using namespace std;
 
void Alice(int n, int m, int A[], int B[] ){
  vector<pair<int, int>> edges;
  for (int i = 0; i < m; ++i) {
    edges.emplace_back(A[i], B[i]);
  }
 
  for (int bit = 0; bit < 10; ++bit) {
    for (int node = 0; node < n; ++node) {
      if (node & (1 << bit)) {
        edges.emplace_back(n + bit, node);
      }
    }
  }
 
  for (int node = 0; node < n; ++node) {
    edges.emplace_back(n + 10, node);
  }
 
  for (int bit = 1; bit < 10; ++bit) {
    edges.emplace_back(n + bit - 1, n + bit);
    edges.emplace_back(n + 11, n + bit);
  }
 
  InitG(n + 12, edges.size());
  for (int i = 0; i < (int)edges.size(); ++i) {
    MakeG(i, edges[i].first, edges[i].second);
  }
}
#include <bits/stdc++.h>
#include "Boblib.h"
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < ll , ll >
#define F first
#define S second
//#define endl '\n'
#define int long long
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#define kill(x) return cout<<x<<'\n', 0;
using namespace std;
void Bob(int V,int U,int C[],int D[]){
    ll id=0,mx=0;
    vector <int> g[V];
    for (int i=0;i<U;i++){
        g[C[i]].pb(D[i]);
        g[D[i]].pb(C[i]);
    }
    for (int i=0;i<V;i++){
        if (g[i].size()>mx){
            mx=g[i].size();
            id=i;
        }
    }
    ll w=0;
    ll vis[V];
    memset(vis,0,sizeof vis);
    ll bad[V];
    memset(bad,0,sizeof bad);
    for (auto u : g[id]){
        vis[u]=1;
    }
    for (int i=0;i<V-1;i++){
        if (vis[i]==0) w=i;
    }
    bad[w]=2;
    bad[id]=2;
   // cout << id << " rvr " << w << endl;
    vector <pii> ras;
    for (auto u : g[w]){
        ras.pb({g[u].size(),u});
        bad[u]=1;
    }
    sort(ras.begin(),ras.end());
    vector <int> bit;
   // bit.pb(ras[0].S);
    queue <int> q;
    q.push(ras[0].S);
    while(q.size()){
        ll v=q.front();
        bad[v]=2;
        q.pop();
        bit.pb(v);
        for (auto u : g[v]){
            if (bad[u]==1){
                q.push(u);
            }
        }
    }
    reverse(bit.begin(),bit.end());
    ll val[V];
    memset(val,0,sizeof val);
    for (int i=0;i<bit.size();i++){
        ll v=bit[i];
        for (auto u : g[v]){
            if (bad[u]) continue;
            val[u]+=(1<<i);
        }
    }
    vector <pii> m;
    for (int i=0;i<V;i++){
        if (bad[i]) continue;
        for (auto u : g[i]){
            if (bad[u]) continue;
            m.pb({val[u],val[i]});
        }
    }
  //  for (auto u : m){
    //    cout << u.F << " " << u.S << endl;
    //}
    //for (int i=0;i<V;i++){
      //  cout << val[i] << " fejf " << bad[i] << endl;
    //}
    //for (auto u : bit){
      //  cout << u << endl;
    //}
    InitMap(V-12,m.size());
    for (auto u : m){
        MakeMap(u.F,u.S);
    }
}

Compilation message

Bob.cpp: In function 'void Bob(long long int, long long int, long long int*, long long int*)':
Bob.cpp:23:24: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   23 |         if (g[i].size()>mx){
      |             ~~~~~~~~~~~^~~
Bob.cpp:66:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   66 |     for (int i=0;i<bit.size();i++){
      |                  ~^~~~~~~~~~~
/tmp/ccv0V9Sa.o: In function `main':
grader_bob.cpp:(.text.startup+0xe8): undefined reference to `Bob(int, int, int*, int*)'
collect2: error: ld returned 1 exit status