Submission #788449

#TimeUsernameProblemLanguageResultExecution timeMemory
788449BulaDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() //#define int ll const ll mod=1e9+7; vector<int> find_subset(int l,int u,vector<int> w){ #define int long long int n = w.size(); vector< pair<int,int> > v(n); for(int i=0;i<n;i++){ v[i].first = w[i]; v[i].second = i; } sort(all(v)); int j=0,sum=0; for(int i=0;i<n;i++){ sum+=v[i].first; while(sum > u && j < i){ sum-=v[j].first; j++; } if(l <= sum && sum <= u){ vector<int> ans; for(int o=j;o<=i;o++) ans.pb(v[o].second); return ans; } } return {}; #undef int }

Compilation message (stderr)

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