跳到正文

个人记录

block

wuyi2026约 2 分钟
原文
文章信息与版本

文章信息

收录
2026年8月1日
更新
2026年8月6日
篇幅
约 2 分钟

版本

  1. v1当前

#include<bits/stdc++.h> using namespace std; struct node{ long long a,b; }; map<long long,long long>a,b; long long m,n,k,l,d; node ansk[1005],ansl[1005]; bool cmp(node x,node y){ return x.b>y.b; } bool cmp2(node x,node y){ return x.a<y.a; } int main(){ cin>>m>>n>>k>>l>>d; int x,y,p,q; for(int i=1;i<=d;i++){ cin>>x>>y>>p>>q; if(x==p)b[min(y,q)]++; if(y==q)a[min(x,p)]++; } int j=0; for(auto i=a.rbegin();i!=a.rend();i++,j++){ ansk[j].b=i->second; ansk[j].a=i->first; } sort(ansk,ansk+j,cmp); sort(ansk,ansk+k,cmp2); j=0; for(auto i=b.rbegin();i!=b.rend();i++,j++){ ansl[j].b=i->second; ansl[j].a=i->first; } sort(ansl,ansl+j,cmp); sort(ansl,ansl+l,cmp2); for(int i=0;i<k;i++){ cout<<ansk[i].a<<” ”; } cout<<endl; for(int i=0;i<l;i++){ cout<<ansl[i].a<<” ”; } return 0; }

原文