Submission #1051619

#TimeUsernameProblemLanguageResultExecution timeMemory
1051619Gromp15Carnival Tickets (IOI20_tickets)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define ll long long #include "tickets.h" const ll INF = 1e18; long long find_maximum(int k, std::vector<std::vector<int>> a) { int n = a.size(); int m = a[0].size(); if (m == 1) { vector<int> x(n); for (int i = 0; i < n; i++) x[i] = a[i][0]; sort(all(x)); ll ans = 0; for (int i = 0; i < n / 2; i++) ans -= x[i]; for (int i = n / 2; i < n; i++) ans += x[i]; return ans; } }

Compilation message (stderr)

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:11:3: error: 'vector' was not declared in this scope
   11 |   vector<int> x(n);
      |   ^~~~~~
tickets.cpp:11:3: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from tickets.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from tickets.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
tickets.cpp:11:10: error: expected primary-expression before 'int'
   11 |   vector<int> x(n);
      |          ^~~
tickets.cpp:12:31: error: 'x' was not declared in this scope
   12 |   for (int i = 0; i < n; i++) x[i] = a[i][0];
      |                               ^
tickets.cpp:13:12: error: 'x' was not declared in this scope
   13 |   sort(all(x));
      |            ^
tickets.cpp:13:8: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
   13 |   sort(all(x));
      |        ^~~
      |        std::filesystem::perms::all
In file included from /usr/include/c++/10/filesystem:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from tickets.cpp:1:
/usr/include/c++/10/bits/fs_fwd.h:148:7: note: 'std::filesystem::perms::all' declared here
  148 |       all  =  0777,
      |       ^~~
tickets.cpp:13:3: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   13 |   sort(all(x));
      |   ^~~~
      |   std::sort
In file included from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from tickets.cpp:1:
/usr/include/c++/10/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
tickets.cpp:19:1: warning: control reaches end of non-void function [-Wreturn-type]
   19 | }
      | ^