제출 #1333099

#제출 시각아이디문제언어결과실행 시간메모리
1333099patgraSpy 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

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, t = T, x = 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});
    }
    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

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, t = T, x = X;
    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) 메시지

# 1번째 컴파일 단계

Aoi.cpp: In function 'std::string aoi(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>)':
Aoi.cpp:35:37: error: no match for 'operator=' (operand types are 'std::vector<long long int>' and 'std::vector<int>')
   35 |     n = N, m = M, q = Q, k = K, t = T, x = X;
      |                                     ^
In file included from /usr/include/c++/13/vector:72,
                 from /usr/include/c++/13/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53,
                 from Aoi.cpp:1:
/usr/include/c++/13/bits/vector.tcc:210:5: note: candidate: 'constexpr std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const std::vector<long long int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/13/vector:66:
/usr/include/c++/13/bits/stl_vector.h:766:7: note: candidate: 'constexpr std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/13/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<long long int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/13/bits/stl_vector.h:788:7: note: candidate: 'constexpr std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/13/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::initializer_list<long long int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
Aoi.cpp:35:44: error: no match for 'operator=' (operand types are 'std::vector<long long int>' and 'std::vector<int>')
   35 |     n = N, m = M, q = Q, k = K, t = T, x = X;
      |                                            ^
/usr/include/c++/13/bits/vector.tcc:210:5: note: candidate: 'constexpr std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const std::vector<long long int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/13/bits/stl_vector.h:766:7: note: candidate: 'constexpr std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/13/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<long long int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/13/bits/stl_vector.h:788:7: note: candidate: 'constexpr std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/13/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::initializer_list<long long int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~