QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#749151#9320. Find the Easiest ProblemklhwongCompile Error//C++14611b2024-11-14 22:50:412024-11-14 22:50:45

Judging History

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

  • [2024-11-14 22:50:45]
  • 评测
  • [2024-11-14 22:50:41]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

inline void work(){
    int n; cin >> n;
    set<string> names;
    for(int i = 0; i < n; i++){
        string tname, prob, res;
        cin >> tname >> prob >> res;
        if(res!="accepted") continue;
        names[prob[0]-'A'].insert(tname);
    }
    int ans = 0;
    for(int i = 0; i < n; i++){if(names[i].size() >= names[ans].size()) ans = i;}
    cout << (char)('A' + ans) << endl;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int t;
    cin >> t;
    while(t--) work();
    return 0;
}

详细

answer.code: In function ‘void work()’:
answer.code:12:14: error: no match for ‘operator[]’ (operand types are ‘std::set<std::__cxx11::basic_string<char> >’ and ‘int’)
   12 |         names[prob[0]-'A'].insert(tname);
      |              ^
answer.code:15:40: error: no match for ‘operator[]’ (operand types are ‘std::set<std::__cxx11::basic_string<char> >’ and ‘int’)
   15 |     for(int i = 0; i < n; i++){if(names[i].size() >= names[ans].size()) ans = i;}
      |                                        ^
answer.code:15:59: error: no match for ‘operator[]’ (operand types are ‘std::set<std::__cxx11::basic_string<char> >’ and ‘int’)
   15 |     for(int i = 0; i < n; i++){if(names[i].size() >= names[ans].size()) ans = i;}
      |                                                           ^