QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#703781#6634. Central SubsetlvliangCompile Error//C++141.5kb2024-11-02 18:29:472024-11-02 18:29:52

Judging History

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

  • [2024-11-02 18:29:52]
  • 评测
  • [2024-11-02 18:29:47]
  • 提交

answer

#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#define x first
#define y second
using namespace std;
const int N = 2e5 + 10;
int h[N], e[N << 1], ne[N << 1], idx;
int ans[N], tp;
int p[N];

void add(int a, int b) {
    e[++idx] = b, ne[idx] = h[a], h[a] = idx;
}

int find(int x) {
    if (x ^ p[x]) p[x] = find(p[x]);
    return p[x];
}

int sqrtn;
int dfs(int u, int fa) {
    int dist = 0;
    for (int i = h[u]; i; i = ne[i]) {
        int j = e[i];
        if (j == fa) continue;
        dist = max(dfs(j, u) + 1, dist);
    }
    if (dist == sqrtn) {
        ans[tp++] = u;
        dist = -1;
    }
    return dist;
}

void solve(int x) {
    
    tp = 0;
    idx = 0;
    
    int n, m;
    scanf("%d%d", &n, &m);
    int f = false;
    if (x == 420) f = true;
    if (f) cout << n << " " << m << endl;
    for (int i = 1; i <= n; i++) p[i] = i, h[i] = 0;
    for (int i = 0; i < m; i++) {
        int u, v;
        scanf("%d%d", &u, &v);
        cout << u << " " << v < endl;
        int fu = find(u), fv = find(v);
        if (fu ^ fv) {
            p[fu] = fv;
            add(u, v), add(v, u);
        }
    }
    if (x < 420) return;
    
    sqrtn = ceil(sqrt(n));
    dfs(1, -1);
    if (!tp) ans[tp++] = 1;
    printf("%d\n", tp);
    for (int i = 0; i < tp; i++) {
        printf("%d ", ans[i]);
    }
    puts("");
}

int main() {
    int T;
    scanf("%d", &T);
    int i = 0
    while (T--) {
        i++;
        solve(i);
    }
    return 0;
}

详细

answer.code: In function ‘void solve(int)’:
answer.code:51:31: error: no match for ‘operator<’ (operand types are ‘std::basic_ostream<char>’ and ‘<unresolved overloaded function type>’)
   51 |         cout << u << " " << v < endl;
      |         ~~~~~~~~~~~~~~~~~~~~~~^~~~~~
In file included from /usr/include/c++/13/string:48,
                 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/bits/stl_iterator.h:455:5: note: candidate: ‘template<class _Iterator> bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)’
  455 |     operator<(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/13/bits/stl_iterator.h:455:5: note:   template argument deduction/substitution failed:
answer.code:51:33: note:   ‘std::basic_ostream<char>’ is not derived from ‘const std::reverse_iterator<_Iterator>’
   51 |         cout << u << " " << v < endl;
      |                                 ^~~~
/usr/include/c++/13/bits/stl_iterator.h:500:5: note: candidate: ‘template<class _IteratorL, class _IteratorR> bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)’
  500 |     operator<(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/13/bits/stl_iterator.h:500:5: note:   template argument deduction/substitution failed:
answer.code:51:33: note:   ‘std::basic_ostream<char>’ is not derived from ‘const std::reverse_iterator<_Iterator>’
   51 |         cout << u << " " << v < endl;
      |                                 ^~~~
/usr/include/c++/13/bits/stl_iterator.h:1705:5: note: candidate: ‘template<class _IteratorL, class _IteratorR> bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)’
 1705 |     operator<(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/13/bits/stl_iterator.h:1705:5: note:   template argument deduction/substitution failed:
answer.code:51:33: note:   ‘std::basic_ostream<char>’ is not derived from ‘const std::move_iterator<_IteratorL>’
   51 |         cout << u << " " << v < endl;
      |                                 ^~~~
/usr/include/c++/13/bits/stl_iterator.h:1770:5: note: candidate: ‘template<class _Iterator> bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)’
 1770 |     operator<(const move_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/13/bits/stl_iterator.h:1770:5: note:   template argument deduction/substitution failed:
answer.code:51:33: note:   ‘std::basic_ostream<char>’ is not derived from ‘const std::move_iterator<_IteratorL>’
   51 |         cout << u << " " << v < endl;
      |                                 ^~~~
In file included from /usr/include/c++/13/bits/stl_algobase.h:64,
                 from /usr/include/c++/13/string:51:
/usr/include/c++/13/bits/stl_pair.h:835:5: note: candidate: ‘template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)’
  835 |     operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
/usr/include/c++/13/bits/stl_pair.h:835:5: note:   template argument deduction/substitution failed:
answer.code:51:33: note:   ‘std::basic_ostream<char>’ is not derived from ‘const std::pair<_T1, _T2>’
   51 |         cout << u << " " << v < endl;
      |                                 ^~~~
In file included from /usr/include/c++/13/string:54:
/usr/include/c++/13/bits/basic_string.h:3817:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’
 3817 |     operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/basic_string.h:3817:5: note:   template argument deduction/substitution failed:
answer.code:51:33: note:   ‘std::basic_ostream<char>’ is not derived from ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’
   51 |         cout << u << " " << v < endl;
      |                                 ^~~~
/usr/include/c++/13/bits/basic_string.h:3831:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)’
 3831 |     operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/basic_string.h:3831:5: note:   template argument deduction/substitution failed:
answer.code:51:33: note:   ‘std::basic_ostream<char>’ is not derived from ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’
   51 |         cout << u << " " << v < endl;
      |        ...