198722025-12-28 12:45:29madvirMegrendelésekcpp17Forditási hiba
#include <iostream>
#include <algorithm>

using namespace std;

struct rendeles {
    int sor, hat;
};

bool rule(rendeles x, rendeles y) {
    return x.hat<y.hat;
}

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    rendeles a[10001];
    for(int i=1; i<=m; i++) {
        cin >> a[i].hat;
        a[i].sor=i;
    }
    sort(a+1, a+m+1, rule);
    
    ///until here its the exact same, except for the fact that shes using a vector.
    //she is using a struct too, with the same values: ind=sor, ido=hat
    //r is a for her, jo is b. imma change this too, to make things easier for myself

    rendeles b[10001];

    //lets change this while to check each day

    int t=0, nc=1, lim=0, veg=0, ag=1, bg=1;
    while(nc<=n) {
        while(a[ag]>=nc && lim<k && ag<=m) {
            b[bg].sor=a[ag].sor;
            b[bg].hat=nc;
            bg++;
            ag++;
            lim++;
        }
        nc++;
    }
    cout << bg-1 << endl;
    for(int i=1; i<jg; i++) {
        cout << b[i].sor << " " << b[i].hat;
    }
    return 0;
}
Forditási hiba
open /var/local/lib/isolate/417/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:34:20: error: no match for 'operator>=' (operand types are 'rendeles' and 'int')
   34 |         while(a[ag]>=nc && lim<k && ag<=m) {
      |               ~~~~~^~~~
      |                   |  |
      |                   |  int
      |                   rendeles
In file included from /usr/include/c++/12/string:47,
                 from /usr/include/c++/12/bits/locale_classes.h:40,
                 from /usr/include/c++/12/bits/ios_base.h:41,
                 from /usr/include/c++/12/ios:42,
                 from /usr/include/c++/12/ostream:38,
                 from /usr/include/c++/12/iostream:39,
                 from main.cpp:1:
/usr/include/c++/12/bits/stl_iterator.h:479:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
  479 |     operator>=(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/12/bits/stl_iterator.h:479:5: note:   template argument deduction/substitution failed:
main.cpp:34:22: note:   'rendeles' is not derived from 'const std::reverse_iterator<_Iterator>'
   34 |         while(a[ag]>=nc && lim<k && ag<=m) {
      |                      ^~
/usr/include/c++/12/bits/stl_iterator.h:523:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  523 |     operator>=(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/12/bits/stl_iterator.h:523:5: note:   template argument deduction/substitution failed:
main.cpp:34:22: note:   'rendeles' is not derived from 'const std::reverse_iterator<_Iterator>'
   34 |         while(a[ag]>=nc && lim<k && ag<=m) {
      |                      ^~
/usr/include/c++/12/bits/stl_iterator.h:1713:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>=(c...