QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#347558#7531. Hacking the Projectucup-team1209Compile Error//C++202.6kb2024-03-09 14:15:202024-03-09 14:15:22

Judging History

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

  • [2024-03-09 14:15:22]
  • 评测
  • [2024-03-09 14:15:20]
  • 提交

answer

#include <bits/stdc++.h>
#define cs const
#define pb push_back
using namespace std;
using ll = long long ;
cs int N = 1e3 + 5;
int T, n; 
set <string> ans; 
vector <string> tmp; 
char cc[15];

int dp[27][N][N];
int frm[27][N][N];

struct jkasdf {
    std::vector<std::string> s;
    void init(int n) {
        s.clear();
        std::mt19937 gen;
        for(int i = 0;i < n;++i) {
            std::string s;
            for(int j = 0;j < 10;++j) s += "abc"[min(gen() % 3, gen() % 3)];
        }
    }
    std::vector<std::string> qry(char c, int k) {
        std::vector<string> ret;
        for(auto j : s) if(s[0] == 'c') ret.push_back(j);
        if(ret.size() > k)ret.resize(k);
        return ret;
    }
} ob;
int all; 


int work(int u, int l, int S) {
    if(u == 1) return S; 
    if(dp[u][l][S] >= 0) return dp[u][l][S];
    int ans = 1e9; 
    for(int i = l + 1; i <= S; i = i * 1.1 + 1) {
        int c = i * u; 
        int mx = 0; 
        for(int k = 1; k <= u; k++) {
            if(k * i + (u - k) * l <= S) {
                mx = max(mx, work(k, i, S - (u - k) * l));
            }
            else break;
        }
        if(mx + c < ans) {
            ans = mx + c; 
            frm[u][l][S] = i; 
        }
    }
    return dp[u][l][S] = ans; 
}

int query(int x, int k) {
    return ob.qry(x + 'a', k);
    
    cout << "query " << (char) (x + 'a') << ' ' << k << endl;
    int s;
    tmp.clear();
    scanf("%d", &s);
    for(int i = 1; i <= s; i++) {
        scanf("%s", cc);
        string c = cc; 
        ans.insert(c);
        tmp.pb(c);
    }
    all += k; 
    return s; 
}

void my_work(int u, int l, int S, vector <int> cur) {
    if(u == 0) {
        return ;
    }
    if(u == 1) {
        query (cur[0], S);
        return ; 
    }
    work(u, l, S);
    int i = frm[u][l][S];
    // cout << "FFFFFFF " << u << ' ' << l << ' ' << S << ' ' << i <<endl;
    assert(i > 0);
    vector <int> nx; 
    for(int x : cur) {
        int s = query (x, i);
        if(s < i) {
            S -= s;
        }
        else {
            nx.pb(x);
        }
    }
    my_work(nx.size(), i, S, nx);
    assert(all <= 3800);
}
void Main() {
    all = 0; 
    scanf("%d", &n);
    ob.init(n);
    work(26, 0, n);
    vector <int> S; 
    for(int i = 0; i < 26; i++) 
        S.pb(i);
    my_work(26, 0, n, S);
    cout << "answer ";
    for(auto s : ans) cout << s << ' ';
    cout << endl; 
}
int main() {
    // #ifdef zqj
    // freopen("1.in","r",stdin);
    // #endif
    memset(dp, -1, sizeof dp);
    cin >> T; 
    while(T--) Main();
    return 0; 
} 

詳細信息

answer.code: In member function ‘std::vector<std::__cxx11::basic_string<char> > jkasdf::qry(char, int)’:
answer.code:27:33: error: no match for ‘operator==’ (operand types are ‘__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type’ {aka ‘std::__cxx11::basic_string<char>’} and ‘char’)
   27 |         for(auto j : s) if(s[0] == 'c') ret.push_back(j);
In file included from /usr/include/c++/13/regex:68,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:181,
                 from answer.code:1:
/usr/include/c++/13/bits/regex.h:1274:5: note: candidate: ‘template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)’ (reversed)
 1274 |     operator==(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1274:5: note:   template argument deduction/substitution failed:
answer.code:27:36: note:   mismatched types ‘const std::__cxx11::sub_match<_BiIter>’ and ‘char’
   27 |         for(auto j : s) if(s[0] == 'c') ret.push_back(j);
      |                                    ^~~
/usr/include/c++/13/bits/regex.h:1441:5: note: candidate: ‘template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)’ (reversed)
 1441 |     operator==(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1441:5: note:   template argument deduction/substitution failed:
answer.code:27:36: note:   mismatched types ‘const std::__cxx11::sub_match<_BiIter>’ and ‘char’
   27 |         for(auto j : s) if(s[0] == 'c') ret.push_back(j);
      |                                    ^~~
/usr/include/c++/13/bits/regex.h:1613:5: note: candidate: ‘template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)’ (reversed)
 1613 |     operator==(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1613:5: note:   template argument deduction/substitution failed:
answer.code:27:36: note:   mismatched types ‘const std::__cxx11::sub_match<_BiIter>’ and ‘char’
   27 |         for(auto j : s) if(s[0] == 'c') ret.push_back(j);
      |                                    ^~~
In file included from /usr/include/c++/13/bits/stl_algobase.h:67,
                 from /usr/include/c++/13/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51:
/usr/include/c++/13/bits/stl_iterator.h:534:5: note: candidate: ‘template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_IteratorL>&, const reverse_iterator<_IteratorR>&) requires requires{{std::operator==::__x->base() == std::operator==::__y->base()} -> decltype(auto) [requires std::convertible_to<<placeholder>, bool>];}’ (reversed)
  534 |     operator==(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/13/bits/stl_iterator.h:534:5: note:   template argument deduction/substitution failed:
answer.code:27:36: note:   mismatched types ‘const std::reverse_iterator<_IteratorL>’ and ‘char’
   27 |         for(auto j : s) if(s[0] == 'c') ret.push_back(j);
      |                                    ^~~
/usr/include/c++/13/bits/stl_iterator.h:1678:5: note: candidate: ‘template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&) requires requires{{std::operator==::__x->base() == std::operator==::__y->base()} -> decltype(auto) [requires std::convertible_to<<placeholder>, bool>];}’ (reversed)
 1678 |     operator==(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/13/bits/stl_iterator.h:1678:5: note:   template argument deduction/substitution failed:
answer.code:27:36: note:   mismatched types ‘const std::move_iterator<_IteratorL>’ and ‘char’
   27 |         for(auto j : s) if(s[0] == 'c') ret.push_back(j);
      |                                    ^~~
In file included from /usr/include/c++/13/string:43,
                 from /usr/include/c++/13/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52:
/usr/include/c++/13/bits/allocator.h:237:5: note: candidate: ‘template<class _T1, class _T2> constexpr bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)’ (reversed)
  237 |     operator==(const allocator<_T1>&, const allocator<_T2>&)
      |     ^~~~~~~~
/usr/include/c++/13/bits/allocator.h:237:5: note:   template argument deduction/substitution failed:
answer.code:27:36: note:   mismatched types ‘const std::allocator<_CharT>’ and ‘char’
   27 |         for(auto j : s) if(s[0] == 'c') ret.push_back(j);
      |                                    ^~~
In file included from /usr/include/c++/13/bits/basic_string.h:47,
                 from /u...