Submission #875711

#TimeUsernameProblemLanguageResultExecution timeMemory
875711Elvin_FritlDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e5 + 545 , inf = 1e9 + 199; ///#include "molecules.h" vector<int> find_subset(int left, int right, vector<int> w){ ll n = w.size(); ll l = 0 , r = 0; ll sum = 0; vector<pair<ll,ll>>a(n); for(int i=0;i<n;i++) { a[i].first = w[i]; a[i].second = i; } sort(a.begin() , a.end()); vector<ll> res; for(int i=0;i<n;i++) { if(r < n && sum < left){ sum += a[r++].first; } else if(sum > right) { sum -= a[l++].first; } else{ break; } } if(sum < left || sum > right) { return res; } for(int i=l;i<r;i++){ res.push_back(a[i].second); } sort(res.begin() , res.end()); return res; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:33:11: error: could not convert 'res' from 'vector<long long int>' to 'vector<int>'
   33 |    return res;
      |           ^~~
      |           |
      |           vector<long long int>
molecules.cpp:39:10: error: could not convert 'res' from 'vector<long long int>' to 'vector<int>'
   39 |   return res;
      |          ^~~
      |          |
      |          vector<long long int>