比赛 |
20150422 |
评测结果 |
AAAAAAAAAAAAAAA |
题目名称 |
奶牛跑步 |
最终得分 |
100 |
用户昵称 |
Asm.Def |
运行时间 |
0.294 s |
代码语言 |
C++ |
内存使用 |
1.24 MiB |
提交时间 |
2015-04-22 08:51:32 |
显示代码纯文本
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <algorithm>
#include <cmath>
using namespace std;
//#define USEFREAD
#ifdef USEFREAD
#define InputLen 5000000
char *ptr=(char *)malloc(InputLen);
#define getc() (*(ptr++))
#else
#define getc() (getchar())
#endif
#define SetFile(x) (freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout))
template<class T>inline void getd(T &x){
int ch = getc();bool neg = false;
while(!isdigit(ch) && ch != '-')ch = getc();
if(ch == '-')ch = getc(), neg = true;
x = ch - '0';
while(isdigit(ch = getc()))
x = x * 10 - '0' + ch;
if(neg)x = -x;
}
/***********************************************************************/
typedef long long LL;
const int maxn = 100005;
int N, Begin[maxn];
LL T, End[maxn];
int main(){
#ifdef DEBUG
freopen("test.txt", "r", stdin);
#else
SetFile(cowjoga);
#endif
#ifdef USEFREAD
fread(ptr,1,InputLen,stdin);
#endif
getd(N), getd(T);;
int i, ans = N, v;
LL Min = 0x7fffffffffffffffll;
for(i = 1;i <= N;++i){
getd(Begin[i]), getd(v);
End[i] = T * v + Begin[i];
}
for(i = N;i;--i){
if(Min <= End[i])--ans;
else Min = End[i];
}
printf("%d\n", ans);
#ifdef DEBUG
printf("\n%.3lf sec \n", (double)clock() / CLOCKS_PER_SEC);
#endif
return 0;
}