记录编号 |
129802 |
评测结果 |
AAAAAAAAAA |
题目名称 |
[NOIP 2011]选择客栈 |
最终得分 |
100 |
用户昵称 |
Asm.Def |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.062 s |
提交时间 |
2014-10-20 22:54:39 |
内存使用 |
0.31 MiB |
显示代码纯文本
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cctype>
#include <queue>
using namespace std;
#if defined DEBUG
FILE *in = fopen("test","r");
#define out stdout
#else
FILE *in = fopen("hotel.in","r");
FILE *out = fopen("hotel.out","w");
#endif
inline void getint(int &x){
int c = fgetc(in);
while(!isdigit(c))c = fgetc(in);
x = c - '0';
while(isdigit(c = fgetc(in)))x = x * 10 - '0' + c;
}
/*==================================================*/
const int maxn = 200000 + 3;
int n, K, P, cafe;
int Ccnt[52] = {0};//0...i
int OKcnt[52] = {0};//0...cafe
int cur[52] = {0};//此前最近的
int main(){
int i, k, p, ans = 0;
getint(n), getint(K), getint(P);
for(i = 0;i < n;++i){
getint(k), getint(p);
if(p <= P)cafe = i;
if(cur[k] <= cafe)OKcnt[k] = Ccnt[k];
ans += OKcnt[k];
++Ccnt[k];
cur[k] = i;
}
fprintf(out, "%d\n", ans);
return 0;
}