Submission #74174

#TimeUsernameProblemLanguageResultExecution timeMemory
74174renatsjDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "molecules.h" #define ll long long struct masivs{ll val;ll poz;}; masivs ab[200006]; using namespace std; ll i,j,k,n,m,sum,pref[200006],suff[200006]; vector<ll> xx; vector<ll> xcur,xnew; list<ll> vv; bool c1(masivs maz,masivs liel) { if (maz.val==liel.val) { return maz.poz<liel.poz; } return maz.val>liel.val; } vector<int> find_subset(int l, int u, vector<int> w) { n=w.size(); i=0; while (i<n) { ab[i].val=w[i]; ab[i].poz=i; i++; } sort(ab,ab+n,c1); pref[0]=ab[0].val; i=1; while (i<n) { pref[i]=pref[i-1]+ab[i].val; i++; } i=n-1; while (i>=0) { suff[i]=suff[i+1]+ab[i].val; i--; } k=0; while (k<n) { //cout << pref[k] << " " << suff[n-k-1] << "\n"; if (pref[k]>u&&suff[n-k-1]<=l) { sum=0; i=0; while (i<=k) { sum+=ab[i].val; vv.push_back(ab[i].poz); i++; } j=0; while (sum>u) { sum+=ab[i].val; vv.push_back(ab[i].poz); sum-=ab[j].val; vv.pop_front(); i++; j++; } for (int j:vv) { xx.push_back(j); } return xx; } if (pref[k]<=u&&pref[k]>=l) { i=0; sum=0; while (sum<l) { sum+=ab[i].val; xx.push_back(ab[i].poz); i++; } return xx; } if (suff[n-k-1]<=u&&suff[n-k-1]>=l) { i=n-1; sum=0; while (sum<l) { sum+=ab[i].val; xx.push_back(ab[i].poz); i--; } return xx; } k++; } return vector<int>(0); }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:71:20: error: could not convert 'xx' from 'std::vector<long long int>' to 'std::vector<int>'
             return xx;
                    ^~
molecules.cpp:83:20: error: could not convert 'xx' from 'std::vector<long long int>' to 'std::vector<int>'
             return xx;
                    ^~
molecules.cpp:95:20: error: could not convert 'xx' from 'std::vector<long long int>' to 'std::vector<int>'
             return xx;
                    ^~