Submission #300170

# Submission time Handle Problem Language Result Execution time Memory
300170 2020-09-16T22:07:33 Z model_code Carnival Tickets (IOI20_tickets) C++17
Compilation error
0 ms 0 KB
wy-subtask4
#include "tickets.h"
#include <bits/stdc++.h>
using namespace std;

int sum[1505], f[1505], b[1505];
vector< vector<int> > ret;

long long find_maximum(int k, std::vector<std::vector<int>> d) {
	int c = d.size();
	int s = d[0].size();
	vector< pair<long long, pair<int, int> > > V;
	long long ans = 0;
	vector<vector<pair<int, int>>> d2;
	d2.resize(c);
	for (int i = 0; i < c; i++) {
		for (int j = 0; j < s; j++) {
			d2[i].push_back(make_pair(d[i][j], j));
		}
		sort(d2[i].begin(), d2[i].end());
	}

	for (int i = 0; i < c; i++) for (int j = 0; j < s; j++) V.push_back(make_pair(d[i][j], make_pair(i, j)));
	sort(V.begin(), V.end());
	for (int i = 0; i < c*s/2; i++) {
		ans -= V[i].first;
	}
	for (int i = c*s/2; i < c*s; i++) {
		ans += V[i].first;
		sum[V[i].second.first]++;
	}


	ret.resize(c);
	for (int i = 0; i < c; i++) {
		vector<int> v;
		v.resize(s, -1);
		ret[i] = v;
	}
	for (int i = 0; i < k; i++) {
		vector< pair<int, int> > v;
		for (int j = 0; j < c; j++) v.push_back(make_pair(sum[j], j));
		sort(v.begin(), v.end());
		for (int j = 0; j < c/2; j++) {
			ret[v[j].second][d2[v[j].second][f[v[j].second]].second] = i;
			f[v[j].second]++;
		}
		for (int j = c/2; j < c; j++) {
			ret[v[j].second][d2[v[j].second][s-b[v[j].second]-1].second] = i;
			b[v[j].second]++;
			sum[v[j].second]--;
		}
	}
	allocate_tickets(ret);
	return ans;
}

Compilation message

tickets.cpp:1:1: error: 'wy' does not name a type
    1 | wy-subtask4
      | ^~
In file included from /usr/include/c++/9/bits/stl_algobase.h:62,
                 from /usr/include/c++/9/vector:60,
                 from tickets.h:1,
                 from tickets.cpp:2:
/usr/include/c++/9/ext/type_traits.h:162:35: error: 'bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
  162 |   __is_null_pointer(std::nullptr_t)
      |                                   ^
/usr/include/c++/9/ext/type_traits.h:157:5: note: previous declaration 'template<class _Type> bool __gnu_cxx::__is_null_pointer(_Type)'
  157 |     __is_null_pointer(_Type)
      |     ^~~~~~~~~~~~~~~~~
/usr/include/c++/9/ext/type_traits.h:162:26: error: 'nullptr_t' is not a member of 'std'
  162 |   __is_null_pointer(std::nullptr_t)
      |                          ^~~~~~~~~
In file included from /usr/include/c++/9/bits/move.h:55,
                 from /usr/include/c++/9/bits/stl_pair.h:59,
                 from /usr/include/c++/9/bits/stl_algobase.h:64,
                 from /usr/include/c++/9/vector:60,
                 from tickets.h:1,
                 from tickets.cpp:2:
/usr/include/c++/9/type_traits:361:26: error: 'std::size_t' has not been declared
  361 |   template<typename _Tp, std::size_t _Size>
      |                          ^~~
/usr/include/c++/9/type_traits:362:25: error: '_Size' was not declared in this scope
  362 |     struct is_array<_Tp[_Size]>
      |                         ^~~~~
/usr/include/c++/9/type_traits:362:31: error: template argument 1 is invalid
  362 |     struct is_array<_Tp[_Size]>
      |                               ^
/usr/include/c++/9/type_traits:560:42: error: 'nullptr_t' is not a member of 'std'
  560 |     struct __is_null_pointer_helper<std::nullptr_t>
      |                                          ^~~~~~~~~
/usr/include/c++/9/type_traits:560:51: error: template argument 1 is invalid
  560 |     struct __is_null_pointer_helper<std::nullptr_t>
      |                                                   ^
/usr/include/c++/9/type_traits:1253:37: error: 'size_t' is not a member of 'std'
 1253 |     : public integral_constant<std::size_t, alignof(_Tp)> { };
      |                                     ^~~~~~
/usr/include/c++/9/type_traits:1253:57: error: template argument 1 is invalid
 1253 |     : public integral_constant<std::size_t, alignof(_Tp)> { };
      |                                                         ^
/usr/include/c++/9/type_traits:1253:57: note: invalid template non-type parameter
/usr/include/c++/9/type_traits:1258:37: error: 'size_t' is not a member of 'std'
 1258 |     : public integral_constant<std::size_t, 0> { };
      |                                     ^~~~~~
/usr/include/c++/9/type_traits:1258:46: error: template argument 1 is invalid
 1258 |     : public integral_constant<std::size_t, 0> { };
      |                                              ^
/usr/include/c++/9/type_traits:1258:46: note: invalid template non-type parameter
/usr/include/c++/9/type_traits:1260:26: error: 'std::size_t' has not been declared
 1260 |   template<typename _Tp, std::size_t _Size>
      |                          ^~~
/usr/include/c++/9/type_traits:1261:21: error: '_Size' was not declared in this scope
 1261 |     struct rank<_Tp[_Size]>
      |                     ^~~~~
/usr/include/c++/9/type_traits:1261:27: error: template argument 1 is invalid
 1261 |     struct rank<_Tp[_Size]>
      |                           ^
/usr/include/c++/9/type_traits:1262:37: error: 'size_t' is not a member of 'std'
 1262 |     : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
      |                                     ^~~~~~
/usr/include/c++/9/type_traits:1262:65: error: template argument 1 is invalid
 1262 |     : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
      |                                                                 ^
/usr/include/c++/9/type_traits:1262:65: note: invalid template non-type parameter
/usr/include/c++/9/type_traits:1266:37: error: 'size_t' is not a member of 'std'
 1266 |     : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
      |                                     ^~~~~~
/usr/include/c++/9/type_traits:1266:65: error: template argument 1 is invalid
 1266 |     : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
      |                                                                 ^
/usr/include/c++/9/type_traits:1266:65: note: invalid template non-type parameter
/usr/include/c++/9/type_traits:1271:37: error: 'size_t' is not a member of 'std'
 1271 |     : public integral_constant<std::size_t, 0> { };
      |                                     ^~~~~~
/usr/include/c++/9/type_traits:1271:46: error: template argument 1 is invalid
 1271 |     : public integral_constant<std::size_t, 0> { };
      |                                              ^
/usr/include/c++/9/type_traits:1271:46: note: invalid template non-type parameter
/usr/include/c++/9/type_traits:1273:42: error: 'std::size_t' has not been declared
 1273 |   template<typename _Tp, unsigned _Uint, std::size_t _Size>
      |                                          ^~~
/usr/include/c++/9/type_traits:1274:23: error: '_Size' was not declared in this scope
 1274 |     struct extent<_Tp[_Size], _Uint>
      |                       ^~~~~
/usr/include/c++/9/type_traits:1274:36: error: template argument 1 is invalid
 1274 |     struct extent<_Tp[_Size], _Uint>
      |                                    ^
/usr/include/c++/9/type_traits:1275:37: error: 'size_t' is not a member of 'std'
 1275 |     : public integral_constant<std::size_t,
      |                                     ^~~~~~
/usr/include/c++/9/type_traits:1276:24: error: '_Size' was not declared in this scope
 1276 |           _Uint == 0 ? _Size : extent<_Tp,
      |                        ^~~~~
/usr/include/c++/9/type_traits:1277:28: error: template argument 1 is invalid
 1277 |           _Uint - 1>::value>
      |                            ^
/usr/include/c++/9/type_traits:1277:28: note: invalid template non-type parameter
/usr/include/c++/9/type_traits:1282:37: error: 'size_t' is not a member of 'std'
 1282 |     : public integral_constant<std::size_t,
      |                                     ^~~~~~
/usr/include/c++/9/type_traits:1284:31: error: template argument 1 is invalid
 1284 |              _Uint - 1>::value>
      |                               ^
/usr/include/c++/9/type_traits:1284:31: note: invalid template non-type parameter
/usr/include/c++/9/type_traits:1616:26: error: 'size_t' does not name a type
 1616 |       { static constexpr size_t __size = sizeof(_Tp); };
      |                          ^~~~~~
In file included from /usr/include/c++/9/bits/move.h:55,
                 from /usr/include/c++/9/bits/stl_pair.h:59,
                 from /usr/include/c++/9/bits/stl_algobase.h:64,
                 from /usr/include/c++/9/vector:60,
                 from tickets.h:1,
                 from tickets.cpp:2:
/usr/include/c++/9/type_traits:1:1: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
  +++ |+#include <cstddef>
    1 | // C++11 <type_traits> -*- C++ -*-
In file included from /usr/include/c++/9/bits/move.h:55,
                 from /usr/include/c++/9/bits/stl_pair.h:59,
                 from /usr/include/c++/9/bits/stl_algobase.h:64,
                 from /usr/include/c++/9/vector:60,
                 from tickets.h:1,
                 from tickets.cpp:2:
/usr/include/c++/9/type_traits:1618:14: error: 'size_t' has not been declared
 1618 |     template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
      |              ^~~~~~
/usr/include/c++/9/type_traits:1618:48: error: '_Sz' was not declared in this scope
 1618 |     template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
      |                                                ^~~
/usr/include/c++/9/type_traits:1619:14: error: no default argument for '_Tp'
 1619 |       struct __select;
      |              ^~~~~~~~
/usr/include/c++/9/type_traits:1621:14: error: 'size_t' has not been declared
 1621 |     template<size_t _Sz, typename _Uint, typename... _UInts>
      |              ^~~~~~
/usr/include/c++/9/type_traits:1622:23: error: '_Sz' was not declared in this scope
 1622 |       struct __select<_Sz, _List<_Uint, _UInts...>, true>
      |                       ^~~
/usr/include/c++/9/type_traits:1622:57: error: template argument 1 is invalid
 1622 |       struct __select<_Sz, _List<_Uint, _UInts...>, true>
      |                                                         ^
/usr/include/c++/9/type_traits:1625:14: error: 'size_t' has not been declared
 1625 |     template<size_t _Sz, typename _Uint, typename... _UInts>
      |              ^~~~~~
/usr/include/c++/9/type_traits:1626:23: error: '_Sz' was not declared in this scope
 1626 |       struct __select<_Sz, _List<_Uint, _UInts...>, false>
      |                       ^~~
/usr/include/c++/9/type_traits:1626:58: error: template argument 1 is invalid
 1626 |       struct __select<_Sz, _List<_Uint, _UInts...>, false>
      |                                                          ^
/usr/include/c++/9/type_traits:1627:18: error: '_Sz' was not declared in this scope
 1627 |       : __select<_Sz, _List<_UInts...>>
      |                  ^~~
/usr/include/c++/9/type_traits:1627:38: error: template argument 1 is invalid
 1627 |       : __select<_Sz, _List<_UInts...>>
      |                                      ^~
/usr/include/c++/9/type_traits:1618:52: error: '__size' is not a member of 'std::__make_unsigned_selector_base::_List<unsigned char, short unsigned int, unsigned int, long unsigned int, long long unsigned int>'
 1618 |     template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
      |                                               ~~~~~^~~~~~~~~~~~~~~
/usr/include/c++/9/type_traits:1640:68: error: template argument 3 is invalid
 1640 |       using __unsigned_type = typename __select<sizeof(_Tp), _UInts>::__type;
      |                                                                    ^
/usr/include/c++/9/type_traits:1644:40: error: '__unsigned_type' was not declared in this scope
 1644 |  = typename __match_cv_qualifiers<_Tp, __unsigned_type>::__type;
      |                                        ^~~~~~~~~~~~~~~
/usr/include/c++/9/type_traits:1644:55: error: template argument 2 is invalid
 1644 |  = typename __match_cv_qualifiers<_Tp, __unsigned_type>::__type;
      |                                                       ^
/usr/include/c++/9/type_traits:1656:61: error: '__type' in 'class std::__make_unsigned_selector<wchar_t, false, true>' does not name a type
 1656 |  = typename __make_unsigned_selector<wchar_t, false, true>::__type;
      |                                                             ^~~~~~
/usr/include/c++/9/type_traits:1673:62: error: '__type' in 'class std::__make_unsigned_selector<char16_t, false, true>' does not name a type
 1673 |  = typename __make_unsigned_selector<char16_t, false, true>::__type;
      |                                                              ^~~~~~
/usr/include/c++/9/type_traits:1680:62: error: '__type' in 'class std::__make_unsigned_selector<char32_t, false, true>' does not name a type
 1680 |  = typename __make_unsigned_selector<char32_t, false, true>::__type;
      |                                                              ^~~~~~
/usr/include/c++/9/type_traits: In instantiation of 'class std::__make_unsigned_selector<wchar_t, true, false>':
/usr/include/c++/9/type_traits:1767:62:   required from 'class std::__make_signed_selector<wchar_t, false, true>'
/usr/include/c++/9/type_traits:1782:57:   required from here
/usr/include/c++/9/type_traits:1601:13: error: no type named '__type' in 'struct std::__make_unsigned<wchar_t>'
 1601 |       using __unsigned_type
      |             ^~~~~~~~~~~~~~~
/usr/include/c++/9/type_traits:1605:13: error: no type named '__type' in 'struct std::__make_unsigned<wchar_t>'
 1605 |       using __type
      |             ^~~~~~
/usr/include/c++/9/type_traits:1782:59: error: invalid combination of multiple type-specifiers
 1782 |  = typename __make_signed_selector<wchar_t, false, true>::__type;
      |                                                           ^~~~~~
/usr/include/c++/9/type_traits: In instantiation of 'class std::__make_unsigned_selector<char16_t, true, false>':
/usr/include/c++/9/type_traits:1767:62:   required from 'class std::__make_signed_selector<char16_t, false, true>'
/usr/include/c++/9/type_traits:1799:58:   required from here
/usr/include/c++/9/type_traits:1601:13: error: no type named '__type' in 'struct std::__make_unsigned<char16_t>'
 1601 |       using __unsigned_type
      |             ^~~~~~~~~~~~~~~
/usr/include/c++/9/type_traits:1605:13: error: no type named '__type' in 'struct std::__make_unsigned<char16_t>'
 1605 |       using __type
      |             ^~~~~~
/usr/include/c++/9/type_traits:1799:60: error: invalid combination of multiple type-specifiers
 1799 |  = typename __make_signed_selector<char16_t, false, true>::__type;
      |                                                            ^~~~~~
/usr/include/c++/9/type_traits: In instantiation of 'class std::__make_unsigned_selector<char32_t, true, false>':
/usr/include/c++/9/type_traits:1767:62:   required from 'class std::__make_signed_selector<char32_t, false, true>'
/usr/include/c++/9/type_traits:1806:58:   required from here
/usr/include/c++/9/type_traits:1601:13: error: no type named '__type' in 'struct std::__make_unsigned<char32_t>'
 1601 |       using __unsigned_type
      |             ^~~~~~~~~~~~~~~
/usr/include/c++/9/type_traits:1605:13: error: no type named '__type' in 'struct std::__make_unsigned<char32_t>'
 1605 |       using __type
      |             ^~~~~~
/usr/include/c++/9/type_traits:1806:60: error: invalid combination of multiple type-specifiers
 1806 |  = typename __make_signed_selector<char32_t, false, true>::__type;
      |                                                            ^~~~~~
/usr/include/c++/9/type_traits:1838:26: error: 'std::size_t' has not been declared
 1838 |   template<typename _Tp, std::size_t _Size>
      |                          ^~~
/usr/include/c++/9/type_traits:1839:30: error: '_Size' was not declared in this scope
 1839 |     struct remove_extent<_Tp[_Size]>
      |                              ^~~~~
/usr/include/c++/9/type_traits:1839:36: error: template argument 1 is invalid
 1839 |     struct remove_extent<_Tp[_Size]>
      |                                    ^
/usr/include/c++/9/type_traits:1851:26: error: 'std::size_t' has not been declared
 1851 |   template<typename _Tp, std::size_t _Size>
      |                          ^~~
/usr/include/c++/9/type_traits:1852:35: error: '_Size' was not declared in this scope
 1852 |     struct remove_all_extents<_Tp[_Size]>
      |                                   ^~~~~
/usr/include/c++/9/type_traits:1852:41: error: template argument 1 is invalid
 1852 |     struct remove_all_extents<_Tp[_Size]>
      |                                         ^
/usr/include/c++/9/type_traits:1910:12: error: 'std::size_t' has not been declared
 1910 |   template<std::size_t _Len>
      |            ^~~
/usr/include/c++/9/type_traits:1915:23: error: '_Len' was not declared in this scope
 1915 |  unsigned char __data[_Len];
      |                       ^~~~
/usr/include/c++/9/type_traits:1930:12: error: 'std::size_t' has not been declared
 1930 |   template<std::size_t _Len, std::size_t _Align =
      |            ^~~
/usr/include/c++/9/type_traits:1930:30: error: 'std::size_t' has not been declared
 1930 |   template<std::size_t _Len, std::size_t _Align =
      |                              ^~~
/usr/include/c++/9/type_traits:1931:48: error: '_Len' was not declared in this scope
 1931 |     __alignof__(typename __aligned_storage_msa<_Len>::__type)>
      |                                                ^~~~
/usr/include/c++/9/type_traits:1931:52: error: template argument 1 is invalid
 1931 |     __alignof__(typename __aligned_storage_msa<_Len>::__type)>
      |                                                    ^
/usr/include/c++/9/type_traits:1936:23: error: '_Len' was not declared in this scope
 1936 |  unsigned char __data[_Len];
      |                       ^~~~
/usr/include/c++/9/type_traits:1937:37: error: '_Align' was not declared in this scope
 1937 |  struct __attribute__((__aligned__((_Align)))) { } __align;
      |                                     ^~~~~~
/usr/include/c++/9/type_traits:1944:20: error: 'size_t' does not name a type
 1944 |       static const size_t _S_alignment = 0;
      |                    ^~~~~~
/usr/include/c++/9/type_traits:1944:20: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
/usr/include/c++/9/type_traits:1945:20: error: 'size_t' does not name a type
 1945 |       static const size_t _S_size = 0;
      |                    ^~~~~~
/usr/include/c++/9/type_traits:1945:20: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
/usr/include/c++/9/type_traits:1951:20: error: 'size_t' does not name a type
 1951 |       static const size_t _S_alignment =
      |                    ^~~~~~
/usr/include/c++/9/type_traits:1951:20: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
/usr/include/c++/9/type_traits:1954:20: error: 'size_t' does not name a type
 1954 |       static const size_t _S_size =
      |                    ^~~~~~
/usr/include/c++/9/type_traits:1954:20: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
/usr/include/c++/9/type_traits:1969:13: error: 'size_t' has not been declared
 1969 |   template <size_t _Len, typename... _Types>
      |             ^~~~~~
/usr/include/c++/9/type_traits:1976:20: error: 'size_t' does not name a type
 1976 |       static const size_t _S_len = _Len > __strictest::_S_size
      |                    ^~~~~~
/usr/include/c++/9/type_traits:1976:20: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
/usr/include/c++/9/type_traits:1980:20: error: 'size_t' does not name a type
 1980 |       static const size_t alignment_value = __strictest::_S_alignment;
      |                    ^~~~~~
/usr/include/c++/9/type_traits:1980:20: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
/usr/include/c++/9/type_traits:1982:40: error: '_S_len' was not declared in this scope
 1982 |       typedef typename aligned_storage<_S_len, alignment_value>::type type;
      |                                        ^~~~~~
/usr/include/c++/9/type_traits:1982:48: error: 'alignment_value' was not declared in this scope; did you mean 'alignment_of'?
 1982 |       typedef typename aligned_storage<_S_len, alignment_value>::type type;
      |                                                ^~~~~~~~~~~~~~~
      |                                                alignment_of
/usr/include/c++/9/type_traits:1982:63: error: template argument 1 is invalid
 1982 |       typedef typename aligned_storage<_S_len, alignment_value>::type type;
      |                                                               ^
/usr/include/c++/9/type_traits:1982:63: error: template argument 2 is invalid
/usr/include/c++/9/type_traits:1985:13: error: 'size_t' has not been declared
 1985 |   template <size_t _Len, typename... _Types>
      |             ^~~~~~
/usr/include/c++/9/type_traits:1986:11: error: 'size_t' does not name a type
 1986 |     const size_t align