QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#570254#9319. Bull FarmxucaiCompile Error//C++202.4kb2024-09-17 14:58:342024-09-17 14:58:41

Judging History

你现在查看的是最新测评结果

  • [2024-09-17 14:58:41]
  • 评测
  • [2024-09-17 14:58:34]
  • 提交

answer

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <numeric>
#include <queue>
#include <cassert>
#include <cstring>
#include <climits>
#include <iomanip>
#include <cmath>
#include <bitset>

using namespace std;
#define int long long

constexpr int N = 2000 + 5;

void solve()
{
    auto in = [] () {
        char a, b;
        cin >> a >> b;

        int x = a - 48;
        int y = b - 48;
        int z = x * 50 + y;
        return z;
    };

    int n, l, q;
    cin >> n >> l >> q;

    // cout << n << ' ' << l << ' ' << q << '\n';

    vector g(l + 5, vector(n + 5, 0LL));
    for (int i = 1; i <= l; i += 1) {
        for (int j = 1; j <= n; j += 1) {
            g[i][j] = in();
            // cout << g[i][j] << ' ';
        }
        // cout << '\n';
    }

    vector<bitset<N>> f(N);
    for (int i = 1; i <= n; i += 1) f[i][i] = 1;
    auto connect = [&] (int a, int b) {
        if (f[a][b]) return;
        for (int i = 1; i <= n; i += 1) {
            if (f[i][a]) {
                f[i] |= f[b];
            }
        }
    };

    auto work = [&] (vector<int>& to) {
        vector vis(n + 5, 0LL);

        int j2 = 0;
        for (int i = 1; i <= n; i += 1) {
            if (vis[to[i]] == 0) vis[to[i]] = 1;
            else if (j2) return;
            else j2 = to[i];
        }

        if (j2) {
            int j0 = 0;
            for (int i = 1; i <= n; i += 1)
                if (vis[i] == 0) j0 = i;
            for (int i = 1; i <= n; i += 1)
                if (to[i] == j2) connect(i, j0);
        } else {
            for (int i = 1; i <= n; i += 1) 
                connect(i, to[i]);
        }
    };


    vector qry(l + 5, vector<array<int, 3>> ());
    for (int i = 1; i <= q; i += 1) {
        int a = in(), b = in(), c = in();
        // cout << a << ' ' << b << ' ' << c << '\n';
        qry[c].push_back({i, a, b});
    }
    
    vector ans(q + 5, 0LL);
    for (int i = 0; i <= l; i += 1) {
        work(g[i]);
        for (auto [i, a, b] : qry[i]) {
            ans[i] = f[a][b];
        }
    }

    for (int i = 1; i <= q; i += 1) {
        cout << ans[i];
    }
    cout << '\n';
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int t = 1;
    cin >> t;

    while (t --) {
        solve();
    }

    return 0;
}

詳細信息

answer.code: In function ‘void solve()’:
answer.code:85:25: error: no matching function for call to ‘std::vector<std::array<long long int, 3> >::push_back(<brace-enclosed initializer list>)’
   85 |         qry[c].push_back({i, a, b});
      |         ~~~~~~~~~~~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/13/vector:66,
                 from answer.code:4:
/usr/include/c++/13/bits/stl_vector.h:1278:7: note: candidate: ‘constexpr void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::array<long long int, 3>; _Alloc = std::allocator<std::array<long long int, 3> >; value_type = std::array<long long int, 3>]’
 1278 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/13/bits/stl_vector.h:1278:35: note:   no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘const std::vector<std::array<long long int, 3> >::value_type&’ {aka ‘const std::array<long long int, 3>&’}
 1278 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/13/bits/stl_vector.h:1295:7: note: candidate: ‘constexpr void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::array<long long int, 3>; _Alloc = std::allocator<std::array<long long int, 3> >; value_type = std::array<long long int, 3>]’
 1295 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/13/bits/stl_vector.h:1295:30: note:   no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘std::vector<std::array<long long int, 3> >::value_type&&’ {aka ‘std::array<long long int, 3>&&’}
 1295 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
answer.code:91:19: error: deduced type ‘std::array<long long int, 3>’ for ‘<structured bindings>’ is incomplete
   91 |         for (auto [i, a, b] : qry[i]) {
      |                   ^~~~~~~~~
In file included from /usr/include/c++/13/bits/uses_allocator_args.h:38,
                 from /usr/include/c++/13/bits/memory_resource.h:41,
                 from /usr/include/c++/13/string:58,
                 from /usr/include/c++/13/bits/locale_classes.h:40,
                 from /usr/include/c++/13/bits/ios_base.h:41,
                 from /usr/include/c++/13/ios:44,
                 from /usr/include/c++/13/ostream:40,
                 from /usr/include/c++/13/iostream:41,
                 from answer.code:1:
/usr/include/c++/13/tuple:2005:45: note: declaration of ‘struct std::array<long long int, 3>’
 2005 |   template<typename _Tp, size_t _Nm> struct array;
      |                                             ^~~~~
In file included from /usr/include/c++/13/string:48:
/usr/include/c++/13/bits/stl_iterator.h: In instantiation of ‘constexpr __gnu_cxx::__normal_iterator<_Iterator, _Container>& __gnu_cxx::__normal_iterator<_Iterator, _Container>::operator++() [with _Iterator = std::array<long long int, 3>*; _Container = std::vector<std::array<long long int, 3> >]’:
answer.code:91:36:   required from here
/usr/include/c++/13/bits/stl_iterator.h:1111:11: error: cannot increment a pointer to incomplete type ‘std::array<long long int, 3>’
 1111 |         ++_M_current;
      |           ^~~~~~~~~~
/usr/include/c++/13/bits/stl_vector.h: In instantiation of ‘constexpr std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = std::array<long long int, 3>; _Alloc = std::allocator<std::array<long long int, 3> >]’:
/usr/include/c++/13/bits/stl_vector.h:528:7:   required from here
/usr/include/c++/13/bits/stl_vector.h:367:49: error: invalid use of incomplete type ‘struct std::array<long long int, 3>’
  367 |                       _M_impl._M_end_of_storage - _M_impl._M_start);
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:2005:45: note: declaration of ‘struct std::array<long long int, 3>’
 2005 |   template<typename _Tp, size_t _Nm> struct array;
      |                                             ^~~~~
In file included from /usr/include/c++/13/bits/move.h:37,
                 from /usr/include/c++/13/bits/exception_ptr.h:41,
                 from /usr/include/c++/13/exception:164,
                 from /usr/include/c++/13/ios:41:
/usr/include/c++/13/type_traits: In instantiation of ‘struct std::is_destructible<std::array<long long int, 3> >’:
/usr/include/c++/13/bits/stl_construct.h:188:51:   required from ‘constexpr void std::_Destroy(_ForwardIterator, _ForwardIterator) [with _ForwardIterator = array<long long int, 3>*]’
/usr/include/c++/13/bits/alloc_traits.h:947:15:   required from ‘constexpr void std::_Destroy(_ForwardIterator, _ForwardIterator, allocator<_T2>&) [with _ForwardIterator = array<long long int, 3>*; _Tp = array<long long int, 3>]’
/usr/include/c++/13/bits/stl_vector.h:732:15:   required from ‘constexpr std::vector<_Tp, _Alloc>::~vector() [with _Tp = std::array<long long int, 3>; _Alloc = std::allocator<std::array<long long int, 3> >]’
answer.code:81:46:   required from here
/usr/in...