Submission #706763

#TimeUsernameProblemLanguageResultExecution timeMemory
706763Yell0Detecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> pii; typedef long long ll; int find_subset(int l,int u,vector<int> w,int n,&vector<int> result) { vector<pii> a; for(int i=0;i<n;++i) a.push_back({w[i],i}); sort(a.begin(),a.end()); int i=0,j=0; ll sum=0; for(;i<n;++i) { sum+=a[i].first; if(sum>=l) break; } if(sum<l) return 0; for(;j<=i;++j) { sum-=a[j].first; if(sum<=u) break; } if(sum>u) return 0; for(int x=0;x<=i-j;++x) result[x]=a[x+j].second; return 0; }

Compilation message (stderr)

molecules.cpp:7:49: error: expected identifier before '&' token
    7 | int find_subset(int l,int u,vector<int> w,int n,&vector<int> result) {
      |                                                 ^
molecules.cpp:7:50: error: expected ',' or '...'
    7 | int find_subset(int l,int u,vector<int> w,int n,&vector<int> result) {
      |                                                  ^~~~~~~~~~~
molecules.cpp: In function 'int find_subset(int, int, std::vector<int>, int, int&)':
molecules.cpp:23:27: error: 'result' was not declared in this scope
   23 |   for(int x=0;x<=i-j;++x) result[x]=a[x+j].second;
      |                           ^~~~~~