32112023-02-22 16:16:25TuruTamasÜgyfélszolgálat (45)cpp17Wrong answer 13/45128ms6440 KiB
#include <bits/stdc++.h>

using namespace std;

#define pii pair<int, int>

struct comp {
    bool operator()(pii a, pii b) {
        if (a.first < b.first) return false;
        if (b.first < a.first) return true;
        if (a.second < b.second) return false;
        if (b.second < a.second) return true;
        return false;
    }
};

int lines_read = 0;
int N, M;
vector<int> pultok;
queue<pii> q2;

pii next() {
    if (q2.empty()) {
        pii r;
        cin >> r.first >> r.second;
        lines_read++;
        return r;
    }
    pii r = q2.front();
    q2.pop();
    return r;
}
int count(int t) {
    if (lines_read == N) return q2.size();
    pii x;
    cin >> x.first >> x.second;
    lines_read++;
    q2.push(x);
    while (x.first < t && lines_read < N)
    {
        cin >> x.first >> x.second;
        lines_read++;
        q2.push(x);
    }
    return q2.size();
}
int main() {
    cin >> M >> N;
    priority_queue<pii, vector<pii>, comp> q ;
    for (size_t i = 1; i < M+1; i++)
    {
        q.push({0, i});
    }
    
    int E, H;
    int maxvarido = 0;
    int maxvarakozo = 0;
    for (size_t i = 0; i < N; i++)
    {
        
        // cout << i << endl;
        pii temp = next();
        E = temp.first;
        H = temp.second;
        q.push( { max(q.top().first, E) + H, q.top().second } );
        maxvarido = max( maxvarido, q.top().first - E );
        
        if (E < q.top().first) {
            maxvarakozo = max(count(q.top().first), maxvarakozo);
        }
        
        pultok.push_back(q.top().second);
        q.pop();
    }
    while (q.size() > 1) q.pop();
    cout << q.top().first << " " << maxvarido << " " << maxvarakozo << "\n";
    for (int& x : pultok) cout << x << "\n";
}
SubtaskSumTestVerdictTimeMemory
base13/45
1Accepted0/03ms1680 KiB
2Wrong answer0/056ms2920 KiB
3Partially correct1/23ms1948 KiB
4Wrong answer0/23ms2092 KiB
5Wrong answer0/23ms2308 KiB
6Partially correct1/23ms2500 KiB
7Partially correct1/23ms2716 KiB
8Partially correct1/286ms4944 KiB
9Wrong answer0/281ms6208 KiB
10Partially correct1/2101ms5360 KiB
11Partially correct1/281ms5556 KiB
12Wrong answer0/281ms5508 KiB
13Wrong answer0/297ms6292 KiB
14Partially correct1/286ms5500 KiB
15Wrong answer0/290ms6148 KiB
16Wrong answer0/285ms6288 KiB
17Wrong answer0/293ms6284 KiB
18Wrong answer0/290ms6440 KiB
19Partially correct1/2128ms5788 KiB
20Partially correct1/3128ms5900 KiB
21Partially correct2/4101ms5852 KiB
22Partially correct2/4108ms5860 KiB