Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
154762 余建成 校门外的树 C++ Compile Error 0 MS 0 KB 427 2026-05-30 20:15:05

Tests(0/0):


Code:

#include<iostream> using namespace std; int main(){ int a b; cin>>a>>b; vector<bool>tree(a+1,true); for(int i=0;i<b;++i){ int start,end; cin>>start>>end; for(int j=start;j<=end;++j){ tree[j]=false; } } int count=0; for(int i=0;i<=a;++i){ if(tree[i]){ count++; } } cout<<count<<endl; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:4:11: error: expected initializer before 'b'
     int a b;
           ^
Main.cc:5:10: error: 'a' was not declared in this scope
     cin>>a>>b;
          ^
Main.cc:5:13: error: 'b' was not declared in this scope
     cin>>a>>b;
             ^
Main.cc:6:5: error: 'vector' was not declared in this scope
     vectortree(a+1,true);
     ^
Main.cc:6:12: error: expected primary-expression before 'bool'
     vectortree(a+1,true);
            ^
Main.cc:11:13: error: 'tree' was not declared in this scope
             tree[j]=false;
             ^
Main.cc:16:12: error: 'tree' was not declared in this scope
         if(tree[i]){
            ^