Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
162747 张唯一 校门外的树 C++ Accepted 2 MS 280 KB 353 2026-10-18 17:58:57

Tests(10/10):


Code:

#include <bits/stdc++.h> using namespace std; int main() { int a,b; cin>>a>>b; bool c[10001]={false}; int d,e; for (int i=0;i<b;++i) { cin>>d>>e; if (d>e)swap(d,e); for (int j=d;j<=e;j++) { c[j]=true; } } int f=0; for (int i=0;i<=a;i++) { if(c[i])f++; } cout<<(a+1-f)<<endl; return 0; }