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<