QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#579478#9320. Find the Easiest ProblemChristinsCompile Error//C++14965b2024-09-21 14:07:112024-09-21 14:07:12

Judging History

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

  • [2024-09-21 14:07:12]
  • 评测
  • [2024-09-21 14:07:11]
  • 提交

answer

#include <iostream>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>

void solve() {
    int n;
    std::cin >> n;

    std::unordered_set<std::string> vis[26];
    for (int i = 0; i < n; i++) {
        char ID;
        std::string team, status;
        
        std::cin >> team >> ID >> status;
        if (!vis[ID - 'A'].count(team) && status == "accepted") {
            vis[ID - 'A'].insert(team);
        }
    }

    int max = 0;
    for (int i = 0; i < 26; i++) {
        max = std::max(max, static_cast<int>2(vis[i].size()));
    } 

    int ans = 0;
    for (int i = 0; i < 26; i++) {
        if (vis[i].size() == max) {
            ans = std::min(ans, i);
        }
    }

    std::cout << char(ans + 'A') << "\n";
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int t;
    std::cin >> t;

    while (t--) {
        solve();
    }

    return 0;
}

Details

answer.code: In function ‘void solve()’:
answer.code:23:45: error: expected ‘(’ before numeric constant
   23 |         max = std::max(max, static_cast<int>2(vis[i].size()));
      |                                             ^
      |                                             (
answer.code:23:46: error: expression cannot be used as a function
   23 |         max = std::max(max, static_cast<int>2(vis[i].size()));
      |                                             ~^~~~~~~~~~~~~~~