H 呢。。。
by 不是憨憨 @ 2017-07-08 20:30:43
@[A2189413790](/space/show?uid=26225) 设为最高时用了啊
by cstdio @ 2017-07-08 20:31:30
全部先设为h了
by 孤城若梦 @ 2017-07-08 20:31:42
@[半度‘’微凉](/space/show?uid=38521) 嗯
by cstdio @ 2017-07-08 20:33:40
我没注意哈
by 不是憨憨 @ 2017-07-08 20:33:51
先贴一下代码:
```cpp
#include<cstdio>
#include<algorithm>
#include<map>
using namespace std;
const int maxn = 10000 + 10;
int C[maxn],D[maxn];
map<int,int> book[maxn];
int main () {
int N, I, H, R;
scanf("%d%d%d%d",&N,&I,&H,&R);
int a, b;
for(int i = 1; i <= R; i++) {
scanf("%d%d",&a,&b);
if (book[a][b]) continue;
else book[a][b] = 1;
if (a > b) swap(a,b);
D[a+1]--,D[b]++;
}
int ans;
for(int i = 1; i <= N; i++) {
C[i] = C[i-1] + D[i];
printf("%d\n",H+C[i]);
}
return 0;
}
```
by 不是憨憨 @ 2017-07-08 20:34:56
@[A2189413790](/space/show?uid=26225) 我是是在不知道自己哪错了
by 孤城若梦 @ 2017-07-08 20:37:42
先确认一下:
a[j] = a[c] -- 的结果是两个数都减一。。你就是要这样吗
by 不是憨憨 @ 2017-07-08 20:40:05
N^2,TLE了
by ustze @ 2017-07-08 20:41:07
如果TLE就不会问了。。。
by 不是憨憨 @ 2017-07-08 20:42:40