1940 | 2022-12-12 12:47:58 | DragonoidOmega | Áruszállítás üres szakaszai | cpp11 | Compilation 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;
}
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