QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#322750#4828. Four Plus FourSkyanCompile Error//C++232.5kb2024-02-07 16:53:452024-02-07 16:53:45

Judging History

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

  • [2024-02-07 16:53:45]
  • 评测
  • [2024-02-07 16:53:45]
  • 提交

answer

#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
string a[10005], b[10005], s[30005], t[4005];
int c[30005][26], d[4005][26], dd[4005][4005], p[4005];
vector<int> g[30005], res[30005];
map<string, int> m;
bool check(int x, int y) {
    for (int i = 0; i < 26; i++) {
        if (c[x][i] < d[x][i]) {
            return false;
        }
    }
    return true;
}
bool cmp(int x, int y) {
    return p[x] > p[y];
}
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    string ss;
    cin >> ss;
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        if (ss == "keys") cin >> b[i];
    }
    int x, y;
    cin >> x;
    for (int i = 1; i <= x; i++) {
        cin >> s[i];
        m[s[i]] = i;
        for (char w : s[i]) {
            c[i][w - 'a']++;
        }
    }
    cin >> y;
    for (int i = 1; i <= y; i++) {
        cin >> t[i];
        m[t[i]] = i;
        for (char w : t[i]) {
            d[i][w - 'a']++;
        }
    }
    vector<pair<int, int>> v;
    for (int i = 1; i <= x; i++) {
        for (int j = 1; j <= y; j++) {
            if (check(i, j) == true) {
                g[i].push_back(j);
                g[i].push_back(j);
                g[i].push_back(j);
            }
        }
        if (g[i].size() >= 9) {
            v.push_back({g[i].size(), i});
        }
    }
    sort(v.begin(), v.end());
    for (auto w : v) {
        sort(g[w.second].begin(), g[w.second].end(), cmp);
        for (int x : g[w.second]) {
            int flag = 0;
            for (int xx : res[w.second]) {
                if (dd[xx][x] != 0) {
                    flag = 1;
                    break;
                }
            }
            if (flag == 0) res[w.second].push_back(x);
            if (res[w.second] == 3) break;
        }
        for (int i = 0; i < 3; i++) {
            for (int j = i + 1; j < 3; j++) {
                dd[res[w.second][i]][res[w.second][j]] = i;
                dd[res[w.second][j]][res[w.second][i]] = i;
                p[res[w.second][i]]--;
                p[res[w.second][j]]--;
            }
        }
    }
    for (int i = 1; i <= n; i++) {
        if (ss == "password") {
            int h = m[a[i]];
            for (auto w : res[h]) {
                cout << t[w] << " ";
            }
        }
        else {
            cout << s[dd[m[a[i]]][m[b[i]]]];
        }
        cout << '\n';
    }
}

詳細信息

answer.code: In function ‘int main()’:
answer.code:74:31: error: no match for ‘operator==’ (operand types are ‘std::vector<int>’ and ‘int’)
   74 |             if (res[w.second] == 3) break;
      |                 ~~~~~~~~~~~~~ ^~ ~
      |                             |    |
      |                             |    int
      |                             std::vector<int>
In file included from /usr/include/c++/11/bits/stl_algobase.h:67,
                 from /usr/include/c++/11/bits/char_traits.h:39,
                 from /usr/include/c++/11/ios:40,
                 from /usr/include/c++/11/ostream:38,
                 from /usr/include/c++/11/iostream:39,
                 from answer.code:1:
/usr/include/c++/11/bits/stl_iterator.h:495:5: note: candidate: ‘template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const std::reverse_iterator<_IteratorL>&, const std::reverse_iterator<_IteratorR>&) requires requires{{std::operator==::__x->base() == std::operator==::__y->base()} -> decltype(auto) [requires std::convertible_to<<placeholder>, bool>];}’ (reversed)
  495 |     operator==(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/11/bits/stl_iterator.h:495:5: note:   template argument deduction/substitution failed:
answer.code:74:34: note:   mismatched types ‘const std::reverse_iterator<_IteratorL>’ and ‘int’
   74 |             if (res[w.second] == 3) break;
      |                                  ^
In file included from /usr/include/c++/11/bits/stl_algobase.h:67,
                 from /usr/include/c++/11/bits/char_traits.h:39,
                 from /usr/include/c++/11/ios:40,
                 from /usr/include/c++/11/ostream:38,
                 from /usr/include/c++/11/iostream:39,
                 from answer.code:1:
/usr/include/c++/11/bits/stl_iterator.h:1585:5: note: candidate: ‘template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&) requires requires{{std::operator==::__x->base() == std::operator==::__y->base()} -> decltype(auto) [requires std::convertible_to<<placeholder>, bool>];}’ (reversed)
 1585 |     operator==(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/11/bits/stl_iterator.h:1585:5: note:   template argument deduction/substitution failed:
answer.code:74:34: note:   mismatched types ‘const std::move_iterator<_IteratorL>’ and ‘int’
   74 |             if (res[w.second] == 3) break;
      |                                  ^
In file included from /usr/include/c++/11/string:41,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/ostream:38,
                 from /usr/include/c++/11/iostream:39,
                 from answer.code:1:
/usr/include/c++/11/bits/allocator.h:218:5: note: candidate: ‘template<class _T1, class _T2> constexpr bool std::operator==(const std::allocator<_CharT>&, const std::allocator<_T2>&)’ (reversed)
  218 |     operator==(const allocator<_T1>&, const allocator<_T2>&)
      |     ^~~~~~~~
/usr/include/c++/11/bits/allocator.h:218:5: note:   template argument deduction/substitution failed:
answer.code:74:34: note:   mismatched types ‘const std::allocator<_CharT>’ and ‘int’
   74 |             if (res[w.second] == 3) break;
      |                                  ^
In file included from /usr/include/c++/11/bits/basic_string.h:48,
                 from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/ostream:38,
                 from /usr/include/c++/11/iostream:39,
                 from answer.code:1:
/usr/include/c++/11/string_view:541:5: note: candidate: ‘template<class _CharT, class _Traits> constexpr bool std::operator==(std::basic_string_view<_CharT, _Traits>, std::__type_identity_t<std::basic_string_view<_CharT, _Traits> >)’ (reversed)
  541 |     operator==(basic_string_view<_CharT, _Traits> __x,
      |     ^~~~~~~~
/usr/include/c++/11/string_view:541:5: note:   template argument deduction/substitution failed:
answer.code:74:34: note:   mismatched types ‘std::basic_string_view<_CharT, _Traits>’ and ‘int’
   74 |             if (res[w.second] == 3) break;
      |                                  ^
In file included from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/ostream:38,
                 from /usr/include/c++/11/iostream:39,
                 from answer.code:1:
/usr/include/c++/11/bits/basic_string.h:6248:5: note: candid...