Submission #841042

#TimeUsernameProblemLanguageResultExecution timeMemory
841042manhlinh1501Detecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; using i64 = long long; using pli = pair<i64,int>; #define sz(a) (int)a.size() #define eb emplace_back #define all(a) a.begin(),a.end() vector<int> find_subset(int l,int r,vector<int> a){ int n = sz(a); vector<pli> sum(n+1,{0,0}); for(int i=0;i<n;i++){ sum[i+1].first=sum[i].first+a[i]; sum[i+1].second=i; } sort(all(sum)); vector<int> ans; for(int i=1;i<=n;i++){ for(int j=i;j<=n;j++){ i64 res=sum[j].first-sum[i-1].first; if(l<=res and res<=r){ for(int k=i;k<=j;k++) ans.eb(sum[k].second); return ans; } } } sort(all(ans)); return ans; } int n; int l,r; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n>>l>>r; vector<int> a(n); for(int &x : a) cin>>x; for(int x : find_subset(l,r,a)) cout<<x<<" "; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccypfmGP.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc8rQLeQ.o:molecules.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status