257302026-02-28 10:53:13algoproBejgli (80 pont)cpp17Forditási hiba
// UUID: a8069697-3952-434f-9be1-469b814edd72
#include <bits/stdc++.h>
using namespace std;

int main() {
	int x;
	cin >> x;
	vector <int> v(x);
	for (int i = 0; i < x; i++) {
		cin >> v[i];
	}
	int y = 0;
	for (int i = 0; i < x; i++) {
		if (v[i] > y) {
			y = v[i];
		}
	}
	vector <int> h(y);
	y = 0;
	for (int i = 0; i < x;) {
		h[v[i] - 1]++;
		y++;
		i = i + v[i];
	}
	cout >> y >> "\n";
	y = 0;
	for (int i = 0; i < h.size(); i++) {
		if (h[i] > y) {
			y = h[i];
		}
	}
	cout >> y;
}
Forditási hiba
open /var/local/lib/isolate/404/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:25:14: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int')
   25 |         cout >> y >> "\n";
      |         ~~~~ ^~ ~
      |         |       |
      |         |       int
      |         std::ostream {aka std::basic_ostream<char>}
main.cpp:25:14: note: candidate: 'operator>>(int, int)' (built-in)
   25 |         cout >> y >> "\n";
      |         ~~~~~^~~~
main.cpp:25:14: note:   no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int'
In file included from /usr/include/x86_64-linux-gnu/c++/12/bits/stdc++.h:45,
                 from main.cpp:2:
/usr/include/c++/12/cstddef:128:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)'
  128 |     operator>>(byte __b, _IntegerType __shift) noexcept
      |     ^~~~~~~~
/usr/include/c++/12/cstddef:128:5: note:   template argument deduction/substitution failed:
main.cpp:25:9: note:   cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte'
   25 |         cout >> y >> "\n";
      |         ^~~~
In file included from /usr/include/c++/12/string:54,
                 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/istream:38,
                 from /usr/include/c++/12/sstream:38,
                 from /usr/include/c++/12/complex:45,
                 from /usr/include/c++/12/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/12/bits/stdc++.h:54:
/usr/include/c++/12/bits/basic_string.tcc:940:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, ...