Submission #418246

#TimeUsernameProblemLanguageResultExecution timeMemory
418246salehDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include "molecules.h" #include <bits/stdc++.h> #define int long long using namespace std; vector<int32_t> find_subset(int32_t l, int32_t u, vector<int32_t> w) { int n = w.size(), sum = 0; int p = 0, q = n; if (accumulate(w.begin(), w.end(), 0ll) < l) return {}; while (p < n && sum + w[p] <= u) sum += w[p++]; if (sum >= l) { vector<int> v; for (int i = 1; i <= p; i++) v.push_back(i - 1); return v; } while (p > 0 && sum < l) { sum += w[--q]; sum -= w[--p]; } if (sum < l) return {}; else { vector<int> v; for (int i = 1; i <= p; i++) v.push_back(i - 1); for (int i = n; i > q; i--) v.push_back(i - 1); return v; } } //int32_t main() {}

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int32_t, int32_t, std::vector<int>)':
molecules.cpp:17:10: error: could not convert 'v' from 'vector<long long int>' to 'vector<int>'
   17 |   return v;
      |          ^
      |          |
      |          vector<long long int>
molecules.cpp:28:10: error: could not convert 'v' from 'vector<long long int>' to 'vector<int>'
   28 |   return v;
      |          ^
      |          |
      |          vector<long long int>