大佬们,我为什么只得了20分啊

P1047 [NOIP2005 普及组] 校门外的树

@[g13145687](/user/316016) 区间可能有重复
by SCP_0040 @ 2020-02-11 14:59:53


```cpp #include<iostream> using namespace std; int main() { int L, M; cin >> L >> M; int a[100][2]; for (int i = 0; i < M; i++) { cin >> a[i][0] >> a[i][1]; } int*tree = new int[L]; for (int i = 0; i <= L; i++) tree[i] = 0; for (int i = 0; i < M; i++) { for (int j = a[i][0]; j <= a[i][1]; j++) { tree[j] = 1; } } int count= 0; for (int i = 0; i <= L; i++) { if (tree[i] == 0) count++; } cout << count << endl; return 0; } ``` 我的代码 @[g13145687](/user/316016)
by Dimly_dust @ 2020-02-11 15:01:26


已AC
by Dimly_dust @ 2020-02-11 15:02:32


谢谢
by g13145687 @ 2020-02-11 15:03:38


用线段树做(滑稽
by SMT0x400 @ 2020-02-11 15:11:27


|