Submission #909964

#TimeUsernameProblemLanguageResultExecution timeMemory
909964stefanneaguDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; vector<int> find_subset(int l, int r, vector<int> w) { #define int long long vector<pair<int, int>> v; int n = w.size(); v.push_back({0, 0}); for(int i = 1; i <= n; i ++) { v.push_back({w[i - 1], i - 1}); } sort(v.begin(), v.end()); int sum = 0; for(int i = 1, j = 1; i <= n; i ++) { sum += v[i].first; while(sum > r) { sum -= v[j].first; j ++; } if(sum >= l) { vector<int> ans; for(int ind = j; ind <= i; ind ++) { ans.push_back(v[ind].second); } return ans; } } vector<int> am_belit_coaiele; return am_belit_coaiele; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:26:14: error: could not convert 'ans' from 'vector<long long int>' to 'vector<int>'
   26 |       return ans;
      |              ^~~
      |              |
      |              vector<long long int>
molecules.cpp:30:10: error: could not convert 'am_belit_coaiele' from 'vector<long long int>' to 'vector<int>'
   30 |   return am_belit_coaiele;
      |          ^~~~~~~~~~~~~~~~
      |          |
      |          vector<long long int>