Submission #727572

#TimeUsernameProblemLanguageResultExecution timeMemory
727572josanneo22Radio (Balkan15_RADIO)C++17
Compilation error
0 ms0 KiB
/*梁*/ #include <bits/stdc++.h> using namespace std; void solve(){ int n,k; cin>>n>>k; vector<int> x(n),p(n),s(n); for(int i=0;i<n;i++){ cin>>x[i]>>p[i]>>s[i]; } vector<int> order(n); iota(order.begin(),order.end(),[&](int i,int j){ return x[i]+p[i]<x[j]+p[j]; }); int mx=x[order[0]]+p[order[0]]; int ans=0; for(int i=1;i<n;i++){ ans+=max(0,x[order[i]]-p[order[i]]-mx); } cout<<ans<<'\n'; } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); int tt=1; //cin>>tt; while(tt--){ solve(); } }

Compilation message (stderr)

In file included from /usr/include/c++/10/numeric:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:84,
                 from radio.cpp:2:
/usr/include/c++/10/bits/stl_numeric.h: In instantiation of 'void std::iota(_ForwardIterator, _ForwardIterator, _Tp) [with _ForwardIterator = __gnu_cxx::__normal_iterator<int*, std::vector<int> >; _Tp = solve()::<lambda(int, int)>]':
radio.cpp:13:6:   required from here
/usr/include/c++/10/bits/stl_numeric.h:99:15: error: cannot convert 'solve()::<lambda(int, int)>' to 'int' in assignment
   99 |    *__first = __value;
      |               ^~~~~~~
      |               |
      |               solve()::<lambda(int, int)>
/usr/include/c++/10/bits/stl_numeric.h:100:4: error: no match for 'operator++' (operand type is 'solve()::<lambda(int, int)>')
  100 |    ++__value;
      |    ^~~~~~~~~