From d5e7550c97f786fd53ca829973e46777b7a364ad Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Thu, 26 May 2016 07:55:26 +0800 Subject: [PATCH] Create 1664.cpp --- QUSTOJ/1664.cpp | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 QUSTOJ/1664.cpp diff --git a/QUSTOJ/1664.cpp b/QUSTOJ/1664.cpp new file mode 100644 index 0000000..1659df5 --- /dev/null +++ b/QUSTOJ/1664.cpp @@ -0,0 +1,62 @@ +#include +#include +#include +#include + +using namespace std; + + +class seat +{ +public: + friend bool operator < (const seat&,const seat&); + friend bool operator > (const seat&,const seat&); + int x,width; +}; + +bool operator < (const seat& a,const seat& b) +{ + return (a.x (const seat& a,const seat& b) +{ + return (a.x>b.x); +} + +vector pos; +seat tmp; + +int main() +{ + int n,m,i; + while(cin>>n>>m) + { + pos.clear(); + for(i=0;i>tmp.x>>tmp.width; + pos.push_back(tmp); + } + sort(pos.begin(),pos.end()); + int count=2; + for(i=0;i0) + { + count+=2; + } + else if(ans<0) + { + continue; + } + else + { + ++count; + } + } + cout<