Submission #604258

#TimeUsernameProblemLanguageResultExecution timeMemory
604258cheissmartBoxes with souvenirs (IOI15_boxes)C++14
Compilation error
0 ms0 KiB
#include "boxes.h" #include <bits/stdc++.h> #define F first #define S second #define V vector #define PB push_back #define EB emplace_back #define MP make_pair #define SZ(v) (v).begin(), (v).end() #define ALL(v) (v).begin(), (v).end() using namespace std; typedef long long ll; typedef pair<int, int> pi; typedef V<int> vi; const int INF = 1e9 + 7; ll delivery(int n, int k, int l, int p[]) { vi a; for(int i = 0; i < n; i++) if(p[i]) a.PB(p[i]); n = SZ(a); ll ans = 0; for(int i = 0; i < n; i++) { ans += min(a[i], l - a[i]); } return ans; }

Compilation message (stderr)

boxes.cpp: In function 'll delivery(int, int, int, int*)':
boxes.cpp:9:24: error: cannot convert 'std::vector<int>::iterator' to 'int' in assignment
    9 | #define SZ(v) (v).begin(), (v).end()
      |               ~~~~~~~~~^~
      |                        |
      |                        std::vector<int>::iterator
boxes.cpp:24:9: note: in expansion of macro 'SZ'
   24 |     n = SZ(a);
      |         ^~
boxes.cpp:20:24: warning: unused parameter 'k' [-Wunused-parameter]
   20 | ll delivery(int n, int k, int l, int p[]) {
      |                    ~~~~^