mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
Create 7483.cpp
Accepted on VirtualJudge Online : http://acm.hust.edu.cn/vjudge/contest/view.action?cid=115784#problem/F
This commit is contained in:
parent
cde9f20e7a
commit
200530a6ca
50
UVALive/7483.cpp
Normal file
50
UVALive/7483.cpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
/**
|
||||
LINK=
|
||||
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=115784#problem/F
|
||||
*/
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <climits>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
using namespace std;
|
||||
|
||||
#define MAXN 105
|
||||
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
while(scanf("%d",&n)==1)
|
||||
{
|
||||
vector<int> pool[MAXN*2+8];
|
||||
for(int i=0;i<n;i++)
|
||||
{
|
||||
int a,b;
|
||||
scanf("%d %d",&a,&b);
|
||||
pool[a].push_back(b);
|
||||
}
|
||||
int k=INT_MAX;
|
||||
int cnt=0;
|
||||
for(int i=0;i<MAXN*2+8;i++)
|
||||
{
|
||||
if(k<i)
|
||||
{
|
||||
++cnt;
|
||||
k=INT_MAX;
|
||||
}
|
||||
for(int j=0;j<pool[i].size();j++)
|
||||
{
|
||||
k=min(k,pool[i].at(j));
|
||||
}
|
||||
}
|
||||
if(k<INT_MAX)
|
||||
{
|
||||
++cnt;
|
||||
}
|
||||
printf("%d\n",cnt);
|
||||
}
|
||||
/// End of main loop
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user