198772025-12-28 13:39:46madvirMegrendelésekcpp17Wrong answer 0/5041ms760 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 answer1ms500 KiB
5Wrong answer1ms316 KiB
6Wrong answer2ms316 KiB
7Wrong answer1ms316 KiB
subtask30/5
8Wrong answer1ms316 KiB
9Wrong answer2ms316 KiB
10Wrong answer2ms316 KiB
11Wrong answer2ms316 KiB
12Wrong answer4ms420 KiB
subtask40/5
13Wrong answer2ms316 KiB
14Wrong answer27ms632 KiB
15Wrong answer13ms500 KiB
16Wrong answer18ms476 KiB
17Wrong answer6ms316 KiB
subtask50/10
18Wrong answer1ms316 KiB
19Wrong answer2ms316 KiB
20Wrong answer4ms316 KiB
21Wrong answer4ms316 KiB
22Wrong answer3ms316 KiB
23Wrong answer2ms316 KiB
24Wrong answer4ms332 KiB
25Wrong answer20ms528 KiB
26Wrong answer23ms552 KiB
27Wrong answer23ms556 KiB
subtask60/25
28Wrong answer3ms316 KiB
29Wrong answer2ms316 KiB
30Wrong answer4ms316 KiB
31Wrong answer21ms564 KiB
32Wrong answer37ms736 KiB
33Wrong answer20ms496 KiB
34Wrong answer39ms504 KiB
35Wrong answer37ms564 KiB
36Wrong answer37ms528 KiB
37Wrong answer37ms520 KiB
38Wrong answer19ms760 KiB
39Wrong answer4ms508 KiB
40Wrong answer8ms428 KiB
41Wrong answer27ms564 KiB
42Wrong answer4ms316 KiB
43Wrong answer19ms564 KiB
44Wrong answer35ms732 KiB
45Wrong answer8ms316 KiB
46Wrong answer13ms508 KiB
47Wrong answer19ms564 KiB
48Wrong answer41ms580 KiB
49Wrong answer37ms552 KiB
50Wrong answer37ms536 KiB
51Wrong answer39ms488 KiB
52Wrong answer34ms708 KiB