답안 #1068389

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1068389 2024-08-21T09:38:22 Z mc061 통행료 (IOI18_highway) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long

int m;

long long ask(const std::vector<int> &w);
long long get(const vector<int>& busy) {
    vector<int> q(m, 0);
    for (int i : busy) q[i] = 1;
    return ask(q);
}
void answer(int s, int t);

void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) {
    m = U.size();
    vector<int> v(U.size());
    iota(v.begin(), v.end(), 0);
    vector<vector<int>> full;
    int path_le = get(v) / B;
    auto rec = [&] (auto&& self, vector<int> now) -> void {
        long long here = get(now);
        if (here == 1ll*path_le*A) return;
        if (here == 1ll*now.size()*B + 1ll*(path_le-now.size())*A) {
            full.push_back(now);
            return;
        }
        random_shuffle(now.begin(), now.end());
        vector<int> left, right;
        for (int i = 0; i < now.size()/2; ++i) {
            left.push_back(now[i]);
        }
        for (int i = now.size()/2; i < now.size(); ++i) {
            right.push_back(now[i]);
        }
        self(self, left);
        self(self, right);
    };
    rec(rec, v);
    map<int, int> c;
    for (auto& x : full) {
        for (int j : x) {
            c[U[j]]++;
            c[V[j]]++;
        }
    }
    vector<int> vs;
    for (auto [x, y] : c) {
        if (y == 1) vs.push_back(x);
    }
    answer(vs[0], vs[1]);
}

Compilation message

highway.cpp: In lambda function:
highway.cpp:31:27: 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]
   31 |         for (int i = 0; i < now.size()/2; ++i) {
      |                         ~~^~~~~~~~~~~~~~
highway.cpp:34:38: 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]
   34 |         for (int i = now.size()/2; i < now.size(); ++i) {
      |                                    ~~^~~~~~~~~~~~
highway.cpp: In instantiation of 'find_pair(long long int, std::vector<long long int>, std::vector<long long int>, long long int, long long int)::<lambda(auto:23&&, std::vector<long long int>)> [with auto:23 = find_pair(long long int, std::vector<long long int>, std::vector<long long int>, long long int, long long int)::<lambda(auto:23&&, std::vector<long long int>)>&]':
highway.cpp:40:15:   required from here
highway.cpp:25:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'long long unsigned int' [-Wsign-compare]
   25 |         if (here == 1ll*now.size()*B + 1ll*(path_le-now.size())*A) {
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
highway.cpp:31:27: 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]
   31 |         for (int i = 0; i < now.size()/2; ++i) {
      |                         ~~^~~~~~~~~~~~~~
highway.cpp:34:38: 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]
   34 |         for (int i = now.size()/2; i < now.size(); ++i) {
      |                                    ~~^~~~~~~~~~~~
/usr/bin/ld: /tmp/ccqO0Pmi.o: in function `get(std::vector<long long, std::allocator<long long> > const&)':
highway.cpp:(.text+0x293): undefined reference to `ask(std::vector<long long, std::allocator<long long> > const&)'
/usr/bin/ld: /tmp/ccqO0Pmi.o: in function `find_pair(long long, std::vector<long long, std::allocator<long long> >, std::vector<long long, std::allocator<long long> >, long long, long long)':
highway.cpp:(.text+0xd25): undefined reference to `answer(long long, long long)'
/usr/bin/ld: /tmp/ccX9LPsi.o: in function `main':
grader.cpp:(.text.startup+0x16c): undefined reference to `find_pair(int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, int, int)'
collect2: error: ld returned 1 exit status