54112023-05-14 14:36:10kicsiboglarKikötők (35 pont)cpp11Compilation error
#include <iostream>
//#include <fstream>

using namespace std;
//ifstream cin("input.in");
//ofstream cout ("output.out");
using ll= long long;
using P= pair<ll,ll>;

ll n,m,i,j,a,b,maxi=-1,p;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL), cout.tie(NULL);

    cin>>n>>m;
    vector <ll> t(n+2,0);
    vector <P> ship(m+1,{0,0});
    for (i=1;i<=m;++i)
    {
        cin>>ship[i].first>>ship[i].second;
        t[ship[i].first]+=2;
        t[ship[i].second+1]-=2;
    }

    for (i=1;i<=n;++i) t[i]+=t[i-1];
    for (i=1;i<=m;++i)
    {
        t[ship[i].first]--;
        t[ship[i].second]--;
    }

    for (i=1;i<=n;++i)
    {
        if (t[i]>maxi)
        {
            maxi=t[i];
            p=i;
        }
    }
    cout<<p<<" "<<maxi;
}
Compilation error
exit status 1
main.cpp: In function 'int main()':
main.cpp:17:5: error: 'vector' was not declared in this scope
   17 |     vector <ll> t(n+2,0);
      |     ^~~~~~
main.cpp:2:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | //#include <fstream>
main.cpp:17:15: error: expected primary-expression before '>' token
   17 |     vector <ll> t(n+2,0);
      |               ^
main.cpp:17:17: error: 't' was not declared in this scope; did you mean 'tm'?
   17 |     vector <ll> t(n+2,0);
      |                 ^
      |                 tm
main.cpp:18:14: error: expected primary-expression before '>' token
   18 |     vector <P> ship(m+1,{0,0});
      |              ^
main.cpp:18:16: error: 'ship' was not declared in this scope
   18 |     vector <P> ship(m+1,{0,0});
      |                ^~~~
Exited with error status 1