该题细节特别多,注意如果轮到某人的话

#include <bits/stdc++.h>
using namespace std;
const int M = 1e3 + 10;
int n,m,k,q,per;
int cost[M];
int out[M],in[M];
queue<int> dl[21];
void Init(int k){
    for(int i = 1; i <= k; ++i)in[i] = 0;
    for(int i = 1; i <= k; ++i){
        cin >> cost[i];
        int minp = 0;
        for(int j = 0; j < n; ++j)
            if(dl[j].size() < dl[minp].si***p = j;
        if(dl[minp].size() < m){
            dl[minp].push(i);
        }
        out[i] = -1;
    }

}

int main(){
    //freopen("1.txt","r",stdin);
    cin >> n >> m >> k >> q;
    Init(k);
    int total = 0;
    int start = n*m+1;
    while(total < 540){
        total++;
        for(int i = 0; i < n; ++i){
            if(dl[i].size() == 0) continue;
            else{
                cost[dl[i].front()]--;
                in[dl[i].front()] = 1;
                if(cost[dl[i].front()]  == 0){
                out[dl[i].front()] = total;
                dl[i].pop();

                if(start <= k)
                    dl[i].push(start);
                    start++;

                }
            }
        }
    }
    cout.fill('0');
    while(q--){
        cin >> per;
        if(in[per] == 0) cout << "Sorry\n";
        else{
            int h = 8 + out[per]/60;
            int fen = out[per] % 60;
            if(out[per] == -1){
                for(int i = 0; i < n; ++i)
                    if(dl[i].front() == per){
                        int h = 17 + cost[dl[i].front()] / +60;
                        int fen = cost[dl[i].front()] % +60;
                        cout << setw(2) << h << ":" << setw(2) << fen << "\n";
                        break;
                    }
            }
            else
            cout << setw(2) << h << ":" << setw(2) << fen << "\n";

        }
    }
}

,过了下午五点他还没结束的话,要输出直到他结束的时间。细节很多,坑也很多。。