제출 #1333101

#제출 시각아이디문제언어결과실행 시간메모리
1333101patgraSpy 3 (JOI24_spy3)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>

#define rep(a,b,c) for(auto a = (b); a != (c); a++)
#define repD(a,b,c) for(auto a = (b); a != (c); a--)
#define repIn(a, b) for(auto& a : (b))
#define repIn2(a, b, c) for(auto& [a, b] : (c))

constexpr bool dbg = 1;
#define DEBUG if constexpr(dbg)
#define DC DEBUG std::cerr
#define eol std::endl

#define int long long
#define ld long double
#define pb push_back
#define rg ranges

#include "Aoi.h"

using namespace std;

namespace {
    int n;
    int m;
    int q;
    int k;
    vector<vector<pair<int, int>>> g;
    vector<int> t, x, dist;

void getDist() {
}
}

std::string aoi(int32_t N, int32_t M, int32_t Q, int32_t K, std::vector<int32_t> A,
        std::vector<int32_t> B, std::vector<long long> C,
        std::vector<int32_t> T, std::vector<int32_t> X) {
    n = N, m = M, q = Q, k = K;
    repIn(i, T) t.pb(i);
    repIn(i, X) x.pb(i);
    rep(i, 0, m) {
        int a = A[i], b = B[i], c = C[i];
        g[a].pb({b, c});
        g[b].pb({a, c});
    }
    string ans;
    repIn(i, t) {
        string s;
        int x = C[i];
        rep(_, 0, 40) s += (char)(x % 2 + '0'), x /= 2;
        rg::reverse(s);
        ans += s;
    }
    return ans;
}


#include <bits/stdc++.h>

#define rep(a,b,c) for(auto a = (b); a != (c); a++)
#define repD(a,b,c) for(auto a = (b); a != (c); a--)
#define repIn(a, b) for(auto& a : (b))
#define repIn2(a, b, c) for(auto& [a, b] : (c))

constexpr bool dbg = 1;
#define DEBUG if constexpr(dbg)
#define DC DEBUG std::cerr
#define eol std::endl

#define int long long
#define ld long double
#define pb push_back
#define rg ranges

#include "Bitaro.h"

using namespace std;

constexpr int inf = 1e18;

namespace {
    int n;
    int m;
    int q;
    int k;
    vector<vector<pair<int, int>>> g;
    vector<int> t, x;
    vector<pair<int, int>> dist;
    map<pair<int, int>, int> mp;

void getDist() {
    dist.resize(n, {inf, -1});
    dist[0] = {0, 0};
    priority_queue<pair<int, int>> q;
    q.push({0, 0});
    while(q.size()) {
        auto [d, v] = q.top();
        q.pop();
        d *= -1;
        if(dist[v].first != d) continue;
        repIn2(u, c, g[v]) if(dist[u].first > d + c) dist[u] = {d, v}, q.push({-(d + c), u});
    }
}
}

std::string bitaro(int32_t N, int32_t M, int32_t Q, int32_t K, std::vector<int32_t> A,
        std::vector<int32_t> B, std::vector<long long> C,
        std::vector<int32_t> T, std::vector<int32_t> X, string s) {
    n = N, m = M, q = Q, k = K;
    repIn(i, T) t.pb(i);
    repIn(i, X) x.pb(i);
    auto it = s.begin();
    repIn(i, t) {
        int x = 0;
        rep(_, 0, 40) x = x * 2 + (int)(*(it++) - '0');
        C[i] = x;
    }
    rep(i, 0, m) {
        int a = A[i], b = B[i], c = C[i];
        g[a].pb({b, c});
        g[b].pb({a, c});
        mp[{a, b}] = i;
        mp[{b, a}] = i;
    }
    getDist();
    repIn(s, X) {
        vector<int> ans;
        ans.pb(s);
        while(ans.back()) ans.pb(dist[ans.back()].second);
        vector<int> ans2;
        rep(i, 1, ans.size()) {
            auto v = ans[i], u = ans[i - 1];
            ans2.pb(mp[{v, u}]);
        }
        rg::reverse(ans2);
        answer(ans2);
    }
}

컴파일 시 표준 에러 (stderr) 메시지

# 2번째 컴파일 단계

Bitaro.cpp: In function 'std::string bitaro(int32_t, int32_t, int32_t, int32_t, std::vector<int>, std::vector<int>, std::vector<long long int>, std::vector<int>, std::vector<int>, std::string)':
Bitaro.cpp:81:1: warning: no return statement in function returning non-void [-Wreturn-type]
   81 | }
      | ^
/usr/bin/ld: /tmp/ccDQW9hc.o: in function `bitaro(int, int, int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<long long, std::allocator<long long> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
Bitaro.cpp:(.text+0x10f9): undefined reference to `answer(std::vector<long long, std::allocator<long long> > const&)'
collect2: error: ld returned 1 exit status