19402022-12-12 12:47:58DragonoidOmegaÁruszállítás üres szakaszaicpp11Compilation error
#include <iostream>
#include <vector>

using namespace std;
int i,n,m,a,b,db;
int main()
{
    cin>>n>>m;
    vector <int> x(n+2);
    for(i=1;i<=m;++i)
    {
        cin>>a>>b;
        x[a]++;
        x[b+1]--;
    }
    for(i=1;i<=n;++i)
    {
        x[i]+=x[i-1];
        if(x[i]==0 && x[i-1]!=0) db++;
    }
    if(x[1]==0) ++db
    cout<<db;
}
Compilation error
exit status 1
main.cpp: In function 'int main()':
main.cpp:21:21: error: expected ';' before 'cout'
   21 |     if(x[1]==0) ++db
      |                     ^
      |                     ;
   22 |     cout<<db;
      |     ~~~~             
Exited with error status 1