全部评论 1

  • 
    
    #include <bits/stdc++.h>
    using namespace std; 
    int m,n,k,l,d,x[1145],y[1145],c[1001],o[1001];
    int main() {
        cin >> m >> n >> k >> l >> d;
        for(int i = 1;i <= d;i ++) { 
            int xi,yi,pi,qi; 
            cin >> xi >> yi >> pi >> qi;
            if(xi == pi) x[min(yi,qi)] ++;
            else y[min(xi,pi)] ++;
        } 
        for(int i = 1;i <= k;i ++){
            int maxn = -1,p; 
            for(int j = 1;j < m;j ++){ 
                if(y[j] > maxn){ 
                    maxn = y[j]; 
                    p = j; 
                } 
            } 
            y[p] = 0;
            c[p] ++;
        } 
        for(int i = 1;i <= l;i ++){ 
            int maxn = -1,p; 
            for(int j = 1;j < n;j ++){ 
                if(x[j] > maxn){ 
                    maxn = x[j]; 
                    p = j; 
                } 
            } 
            x[p] = 0; 
            o[p] ++; 
        } 
        for(int i = 0;i < 1005;i ++){ 
            if(c[i]) cout << i << " ";
        } 
        cout << endl;
        for(int i = 0;i < 1005;i ++) { 
            if(o[i]) cout << i << " ";
        } 
        return 0; 
    }
    
    
    
    
    

    2024-09-02 来自 北京

    0
首页