Submission #1222301

#TimeUsernameProblemLanguageResultExecution timeMemory
1222301jakeob77Text editor (CEOI24_editor)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define ins insert #define pb push_back void solve(){ int n;cin>>n; int st,stt,g,gg;cin>>st>>stt>>g>>gg; vector<int>a(n); for(int &d:a) cin>>d; cout<<min({abs(st-g)+abs(stt-gg),1+(l[0]+1-gg)})<<endl; } int main() { int t=1; while(t--)solve(); }

Compilation message (stderr)

Main.cpp: In function 'void solve()':
Main.cpp:12:41: error: 'l' was not declared in this scope
   12 |     cout<<min({abs(st-g)+abs(stt-gg),1+(l[0]+1-gg)})<<endl;
      |                                         ^
Main.cpp:12:14: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   12 |     cout<<min({abs(st-g)+abs(stt-gg),1+(l[0]+1-gg)})<<endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from Main.cpp:1:
/usr/include/c++/11/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
Main.cpp:12:14: note:   candidate expects 2 arguments, 1 provided
   12 |     cout<<min({abs(st-g)+abs(stt-gg),1+(l[0]+1-gg)})<<endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from Main.cpp:1:
/usr/include/c++/11/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
Main.cpp:12:14: note:   candidate expects 3 arguments, 1 provided
   12 |     cout<<min({abs(st-g)+abs(stt-gg),1+(l[0]+1-gg)})<<endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from Main.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3449:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3449 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3449:5: note:   template argument deduction/substitution failed:
/usr/include/c++/11/bits/stl_algo.h:3455:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3455 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3455:5: note:   template argument deduction/substitution failed: