From ca98585b3d783e075319049756867ddea9ed344d Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Sun, 22 May 2016 16:01:13 +0800 Subject: [PATCH] Create 1498.cpp --- VIJOS/1498.cpp | 101 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 VIJOS/1498.cpp diff --git a/VIJOS/1498.cpp b/VIJOS/1498.cpp new file mode 100644 index 0000000..23cd697 --- /dev/null +++ b/VIJOS/1498.cpp @@ -0,0 +1,101 @@ +#include +#include +#include +#include +#include +using namespace std; +const int MAXD = 2000+5; +const int MAXM = 1000+5; +const int MAXN = 1000+ 5; +int N,M,L,K,D; + +int XLine[MAXN]; +int YLine[MAXM]; + +struct pack +{ + int value; + int id; + pack(int _Value,int _id) : + value(_Value),id(_id){} +}; + +bool cmp1(const pack& a,const pack& b) +{ + return a.value>b.value; +} +bool cmp2(const pack& a,const pack& b) +{ + return a.id0) + { + ++mcnt; + } + } + //*/ + vector vec; + for(int i=0;i<=M;i++) + { + if(XLine[i]!=0) + { + vec.push_back(pack(XLine[i],i)); + } + } + sort(vec.begin(),vec.end(),cmp1); + sort(vec.begin(),vec.begin()+K,cmp2); + for(int i=0;i0) + { + ++mcnt; + } + } + //*/ + for(int i=0;i<=N;i++) + { + if(YLine[i]!=0) + { + vec.push_back(pack(YLine[i],i)); + } + } + sort(vec.begin(),vec.end(),cmp1); + sort(vec.begin(),vec.begin()+L,cmp2); + for(int i=0;i