喜马拉雅
This commit is contained in:
parent
7e3e0ceda4
commit
48ec4912ca
3
4095_xmly/Readme.md
Normal file
3
4095_xmly/Readme.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# 标题
|
||||||
|
|
||||||
|
* 内容
|
3
4095_xmly/doc/Readme.md
Normal file
3
4095_xmly/doc/Readme.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# 标题
|
||||||
|
|
||||||
|
* 内容
|
47
4095_xmly/main.cpp
Normal file
47
4095_xmly/main.cpp
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#include<iostream>
|
||||||
|
#include <algorithm>
|
||||||
|
using namespace std;
|
||||||
|
int n;
|
||||||
|
bool ce[100001]={0};
|
||||||
|
struct link{
|
||||||
|
int x,y;
|
||||||
|
}a[100001];
|
||||||
|
bool pan(link yi,link er){
|
||||||
|
return yi.x<er.x;
|
||||||
|
}
|
||||||
|
int main(){
|
||||||
|
cin>>n;
|
||||||
|
for(int i=0;i<n;i++){
|
||||||
|
cin>>a[i].x>>a[i].y;
|
||||||
|
}
|
||||||
|
sort(a,a+n,pan);
|
||||||
|
/*
|
||||||
|
for (int i = 0; i <n; i++) {
|
||||||
|
cout<<a[i].x<<" "<<a[i].y <<endl;
|
||||||
|
}*/
|
||||||
|
int now=0,ans=n;
|
||||||
|
for(int i=1;i<n;i++){
|
||||||
|
if(a[now].y+a[now].x-a[i].x>=a[i].y){
|
||||||
|
ce[i]=1;
|
||||||
|
//cout<<ans<<" "<<a[i].x<<" "<<a[i].y <<endl;
|
||||||
|
}else{
|
||||||
|
now=i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
now=n-1;
|
||||||
|
if(ce[now]==1){
|
||||||
|
ans--;
|
||||||
|
}
|
||||||
|
for(int i=n-2;i>=0;i--){
|
||||||
|
if(a[now].y-(a[now].x-a[i].x)>=a[i].y){
|
||||||
|
ce[i]=1;
|
||||||
|
//cout<<ans<<" "<<a[i].x<<" "<<a[i].y <<endl;
|
||||||
|
}else{
|
||||||
|
now=i;
|
||||||
|
}
|
||||||
|
if(ce[i]==1){
|
||||||
|
ans--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cout<<ans;
|
||||||
|
}
|
BIN
4095_xmly/main.exe
Normal file
BIN
4095_xmly/main.exe
Normal file
Binary file not shown.
6
4095_xmly/test/in.txt
Normal file
6
4095_xmly/test/in.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
5
|
||||||
|
25 3
|
||||||
|
105 30
|
||||||
|
20 50
|
||||||
|
10 17
|
||||||
|
100 10
|
4001
4095_xmly/test/in2.txt
Normal file
4001
4095_xmly/test/in2.txt
Normal file
File diff suppressed because it is too large
Load Diff
9001
4095_xmly/test/in3.txt
Normal file
9001
4095_xmly/test/in3.txt
Normal file
File diff suppressed because it is too large
Load Diff
18
4095_xmly/test/out.txt
Normal file
18
4095_xmly/test/out.txt
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
## z:\Chao\src\4095_xmly\test\in.txt
|
||||||
|
2020/04/18 ÖÜÁù 8:28:39.27
|
||||||
|
2
|
||||||
|
-----------------------------------------------
|
||||||
|
Process exited after 240 ms with return value 0
|
||||||
|
|
||||||
|
## z:\Chao\src\4095_xmly\test\in2.txt
|
||||||
|
2020/04/18 ÖÜÁù 8:28:39.27
|
||||||
|
57
|
||||||
|
-----------------------------------------------
|
||||||
|
Process exited after 120 ms with return value 0
|
||||||
|
|
||||||
|
## z:\Chao\src\4095_xmly\test\in3.txt
|
||||||
|
2020/04/18 ÖÜÁù 8:28:39.27
|
||||||
|
82
|
||||||
|
-----------------------------------------------
|
||||||
|
Process exited after 160 ms with return value 0
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user