Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
119788 | 施宸雨 | 校门外的树 | C++ | Accepted | 2 MS | 276 KB | 594 | 2025-05-18 20:46:29 |
#include <iostream> #include <vector> using namespace std; int main() { int L, M; cin >> L >> M; vector<bool> removed(L + 1, false); for (int i = 0; i < M; ++i) { int start, end; cin >> start >> end; if (start > end) { swap(start, end); } for (int j = start; j <= end; ++j) { removed[j] = true; } } int count = 0; for (int i = 0; i <= L; ++i) { if (!removed[i]) { ++count; } } cout << count << endl; return 0; }