QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#749151 | #9320. Find the Easiest Problem | klhwong | Compile Error | / | / | C++14 | 611b | 2024-11-14 22:50:41 | 2024-11-14 22:50:45 |
Judging History
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;} | ^