251222026-02-18 02:10:53999Megrendelésekcpp17Wrong answer 0/5019ms960 KiB
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;
#define int long long
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m,k;cin>>m>>n>>k;
    vector<pair<int,int>> v(n);
    for(int i = 0;i<n;i++){
        cin>>v[i].first;
        v[i].second=i+1;
    }
    sort(v.begin(),v.end());
    vector<pair<int,int>> ans;
    int j = 0;
    for(int i = 1;i<=m;i++){
        int cnt=0;
        while(j<n&&v[j].first<i)j++;
        while(cnt<k&&j<n&&i<=v[j].first){
            ans.push_back({v[j].second,i});
            j++;
            cnt++;
        }
    }
    cout<<ans.size()<<endl;
    for(auto [a,b]:v){
        cout<<a<<' '<<b<<endl;
    }
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer1ms316 KiB
2Wrong answer17ms948 KiB
subtask20/5
3Wrong answer1ms316 KiB
4Wrong answer1ms316 KiB
5Wrong answer2ms316 KiB
6Wrong answer1ms316 KiB
7Wrong answer1ms544 KiB
subtask30/5
8Wrong answer1ms316 KiB
9Wrong answer2ms316 KiB
10Wrong answer2ms316 KiB
11Wrong answer2ms316 KiB
12Wrong answer2ms440 KiB
subtask40/5
13Wrong answer1ms500 KiB
14Wrong answer13ms820 KiB
15Wrong answer7ms564 KiB
16Wrong answer8ms736 KiB
17Wrong answer3ms504 KiB
subtask50/10
18Wrong answer1ms316 KiB
19Wrong answer1ms316 KiB
20Wrong answer2ms316 KiB
21Wrong answer3ms316 KiB
22Wrong answer2ms508 KiB
23Wrong answer2ms316 KiB
24Wrong answer3ms316 KiB
25Wrong answer17ms672 KiB
26Wrong answer19ms668 KiB
27Wrong answer18ms676 KiB
subtask60/25
28Wrong answer2ms500 KiB
29Wrong answer1ms508 KiB
30Wrong answer3ms508 KiB
31Wrong answer10ms564 KiB
32Wrong answer19ms884 KiB
33Wrong answer9ms636 KiB
34Wrong answer18ms932 KiB
35Wrong answer17ms960 KiB
36Wrong answer17ms948 KiB
37Wrong answer17ms956 KiB
38Wrong answer9ms748 KiB
39Wrong answer3ms316 KiB
40Wrong answer4ms424 KiB
41Wrong answer13ms820 KiB
42Wrong answer2ms316 KiB
43Wrong answer8ms752 KiB
44Wrong answer17ms944 KiB
45Wrong answer4ms524 KiB
46Wrong answer6ms460 KiB
47Wrong answer8ms564 KiB
48Wrong answer18ms916 KiB
49Wrong answer19ms948 KiB
50Wrong answer18ms948 KiB
51Wrong answer18ms948 KiB
52Wrong answer16ms956 KiB