为什么编译失败
查看原帖
为什么编译失败
1013002
bjqxszx_zhongqide楼主2024/4/16 16:26
#include<bits/stdc++.h>
using namespace std;
int main() {
    int t;
    cin >> t;
    for (int k = 1; k <= t; ++k) {
        int n;
        cin >> n;
        unordered_map<int, int> teamMap;
        queue<int> q;
        queue<int> teams[1001];
        for (int i = 0; i < n; ++i) {
            int member;
            cin >> member;
            teamMap[member] = k;
        }
        cout << "Scenario #" << k << endl;
        string command;
        while (cin >> command) {
            if (command == "STOP") {
                cout << endl;
                break;
            } else if (command == "ENQUEUE") {
                int x;
                cin >> x;
                int team = teamMap[x];
                if (teams[team].empty()) {
                    q.push(team);
                }
                teams[team].push(x);
            } else if (command == "DEQUEUE") {
                int team = q.front();
                cout << teams[team].front() << endl;
                teams[team].pop();
                if (teams[team].empty()) {
                    q.pop();
                }
            }
        }
    }
    return 0;
}
2024/4/16 16:26
加载中...