Submission #1265723

#TimeUsernameProblemLanguageResultExecution timeMemory
1265723alexiahBoxes with souvenirs (IOI15_boxes)C++20
Compilation error
0 ms0 KiB
using namespace std; typedef long long ll; long long delivery(int n, int k, int l, int p[]) { vector <int> num; num.reserve(n); set <int> aux; int ns = 0; for(int i = 0; i < ns; i++) { num.push_back(l); aux.insert(l); int auxs = aux.size(); aux.insert(p[i]); if(aux.size() != auxs) { num.push_back(p[i]); ns++; } } num.push_back(0); sort(num.begin() , num.end()); int min1 = l; for(ll i = 0; i < ns; i++){ if(n == 1) p[0]*2; min1 = min(min1 , 2*(l- (abs(num[i]) - num[i+1]))); } return min1; }

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:5:5: error: 'vector' was not declared in this scope
    5 |     vector <int> num; num.reserve(n);
      |     ^~~~~~
boxes.cpp:1:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
  +++ |+#include <vector>
    1 | using namespace std;
boxes.cpp:5:13: error: expected primary-expression before 'int'
    5 |     vector <int> num; num.reserve(n);
      |             ^~~
boxes.cpp:5:23: error: 'num' was not declared in this scope; did you mean 'enum'?
    5 |     vector <int> num; num.reserve(n);
      |                       ^~~
      |                       enum
boxes.cpp:6:5: error: 'set' was not declared in this scope
    6 |     set <int> aux;
      |     ^~~
boxes.cpp:1:1: note: 'std::set' is defined in header '<set>'; did you forget to '#include <set>'?
  +++ |+#include <set>
    1 | using namespace std;
boxes.cpp:6:10: error: expected primary-expression before 'int'
    6 |     set <int> aux;
      |          ^~~
boxes.cpp:10:9: error: 'aux' was not declared in this scope
   10 |         aux.insert(l);
      |         ^~~
boxes.cpp:18:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   18 |     sort(num.begin() , num.end());
      |     ^~~~
      |     short
boxes.cpp:22:34: error: 'abs' was not declared in this scope
   22 |         min1 = min(min1 , 2*(l- (abs(num[i]) - num[i+1])));
      |                                  ^~~
boxes.cpp:22:16: error: 'min' was not declared in this scope; did you mean 'min1'?
   22 |         min1 = min(min1 , 2*(l- (abs(num[i]) - num[i+1])));
      |                ^~~
      |                min1