198782025-12-28 13:41:54madvirMegrendelésekcpp17Wrong answer 0/5039ms728 KiB
#include <iostream>
#include <algorithm>

using namespace std;

struct rendeles {
    int sor, hat;
};

bool rule(rendeles x, rendeles y) {
    return x.hat<y.hat;
}

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    rendeles a[10001];
    for(int i=1; i<=m; i++) {
        cin >> a[i].hat;
        a[i].sor=i;
    }
    sort(a+1, a+m+1, rule);
    
    for(int i=1; i<=m; i++) {
        cout << a[i].sor << ", " << a[i].hat << endl;
    }
    
    cout << endl;

    rendeles b[10001];

    //lets change this while to check each day

    int lim, q=1, x=1;
    for(int i=1; i<=n; i++) {
        lim=0;
        while(lim<k && q<=m) {
            if(a[q].hat>=i) {
                b[x].sor=a[q].sor;
                b[x].hat=i;
                lim++;
                x++;
                q++;
            }
        }
        while(a[q].hat==i) q++;
    }
    
    cout << x-1 << endl;
    
    for(int i=1; i<x; i++) {
        cout << b[i].sor << " " << b[i].hat << endl;
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer1ms316 KiB
2Wrong answer32ms564 KiB
subtask20/5
3Wrong answer2ms316 KiB
4Wrong answer2ms316 KiB
5Wrong answer2ms316 KiB
6Wrong answer2ms316 KiB
7Wrong answer1ms316 KiB
subtask30/5
8Wrong answer1ms316 KiB
9Wrong answer2ms316 KiB
10Wrong answer2ms316 KiB
11Wrong answer3ms500 KiB
12Wrong answer4ms324 KiB
subtask40/5
13Wrong answer2ms508 KiB
14Wrong answer26ms524 KiB
15Wrong answer13ms316 KiB
16Wrong answer17ms564 KiB
17Wrong answer4ms316 KiB
subtask50/10
18Wrong answer1ms508 KiB
19Wrong answer2ms316 KiB
20Wrong answer4ms316 KiB
21Wrong answer4ms316 KiB
22Wrong answer3ms316 KiB
23Wrong answer2ms508 KiB
24Wrong answer4ms316 KiB
25Wrong answer21ms524 KiB
26Wrong answer20ms484 KiB
27Wrong answer20ms544 KiB
subtask60/25
28Wrong answer3ms316 KiB
29Wrong answer2ms316 KiB
30Wrong answer4ms316 KiB
31Wrong answer21ms564 KiB
32Wrong answer37ms532 KiB
33Wrong answer19ms572 KiB
34Wrong answer37ms576 KiB
35Wrong answer39ms588 KiB
36Wrong answer37ms528 KiB
37Wrong answer37ms544 KiB
38Wrong answer18ms476 KiB
39Wrong answer4ms508 KiB
40Wrong answer8ms552 KiB
41Wrong answer25ms468 KiB
42Wrong answer4ms500 KiB
43Wrong answer18ms584 KiB
44Wrong answer37ms728 KiB
45Wrong answer8ms316 KiB
46Wrong answer12ms504 KiB
47Wrong answer18ms580 KiB
48Wrong answer37ms664 KiB
49Wrong answer37ms580 KiB
50Wrong answer37ms576 KiB
51Wrong answer37ms512 KiB
52Wrong answer35ms532 KiB