QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#372744#3657. Fantasy Draftsedna_plesko#Compile Error//C++201.2kb2024-03-31 18:22:482024-03-31 18:22:48

Judging History

This is the latest submission verdict.

  • [2024-03-31 18:22:48]
  • Judged
  • [2024-03-31 18:22:48]
  • Submitted

answer


#include <bits/stdc++.h>
#include <string>
#define el '\n';
const int size=65;
using namespace  std;
vector<string> lst[size], ans[size];
int main(){
    vector<string> rank;
    int n,k; cin>>n>>k;
    for (int i=1; i<=n; i++){
        int sz; cin>>sz;
        while(sz--) {
            string s;
            cin >> s;
            lst[i].push_back(s);
        }
    }
    map<string,int> mp;
    int q; cin>>q;
    while(q--){
        string s; cin>>s;
        rank.push_back(s);
    }
    for (int j=1; j<=k; j++){
        for (int i=1; i<=n; i++) {
            bool took = 0;
            for (auto st: lst[i]) {
                if (!mp[st]) {
                    took = 1, mp[st] = 1;
                    ans[i].push_back(st);
                    break;
                }
            }
            if (!took) {
                for (auto rnk:rank) {
                    if (!mp[rnk]) {
                        took = 1, mp[rnk] = 1;
                        ans[i].push_back(rnk);
                        break;
                    }
                }
            }
        }
    }
    for (int i=1; i<=n; i++){
        for (auto it: ans[i])
            cout<<it<<' ';
        cout<<endl;
    }
    return 0 ;
}

详细

answer.code:7:20: error: reference to ‘size’ is ambiguous
    7 | vector<string> lst[size], ans[size];
      |                    ^~~~
In file included from /usr/include/c++/13/string:53,
                 from /usr/include/c++/13/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52,
                 from answer.code:2:
/usr/include/c++/13/bits/range_access.h:274:5: note: candidates are: ‘template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])’
  274 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/13/bits/range_access.h:264:5: note:                 ‘template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)’
  264 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
answer.code:5:11: note:                 ‘const int size’
    5 | const int size=65;
      |           ^~~~
answer.code:7:31: error: reference to ‘size’ is ambiguous
    7 | vector<string> lst[size], ans[size];
      |                               ^~~~
/usr/include/c++/13/bits/range_access.h:274:5: note: candidates are: ‘template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])’
  274 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/13/bits/range_access.h:264:5: note:                 ‘template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)’
  264 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
answer.code:5:11: note:                 ‘const int size’
    5 | const int size=65;
      |           ^~~~
answer.code: In function ‘int main()’:
answer.code:16:13: error: ‘lst’ was not declared in this scope
   16 |             lst[i].push_back(s);
      |             ^~~
answer.code:28:27: error: ‘lst’ was not declared in this scope; did you mean ‘st’?
   28 |             for (auto st: lst[i]) {
      |                           ^~~
      |                           st
answer.code:31:21: error: ‘ans’ was not declared in this scope; did you mean ‘abs’?
   31 |                     ans[i].push_back(st);
      |                     ^~~
      |                     abs
answer.code:39:25: error: ‘ans’ was not declared in this scope; did you mean ‘abs’?
   39 |                         ans[i].push_back(rnk);
      |                         ^~~
      |                         abs
answer.code:47:23: error: ‘ans’ was not declared in this scope; did you mean ‘abs’?
   47 |         for (auto it: ans[i])
      |                       ^~~
      |                       abs