1946 | 2022-12-12 12:52:10 | 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 <long long> x(n+2);
for(i=1;i<=m;++i)
{
cin>>a>>b;
x[a]++;
x[b+1]--;
}
++n
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:16:8: error: expected ';' before 'for'
16 | ++n
| ^
| ;
17 | for(i=1;i<=n;++i)
| ~~~
main.cpp:17:21: error: expected ';' before ')' token
17 | for(i=1;i<=n;++i)
| ^
| ;
Exited with error status 1