Submission #1019841

#TimeUsernameProblemLanguageResultExecution timeMemory
1019841SaltyDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include "molecules.h" #include<bits/stdc++.h> #include "grader.cpp" using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { vector<int> ans,blank; vector<int> temp; temp = w; sort(w.begin(),w.end()); unordered_map<int,int> mp; for(auto val:w){ mp[val]++; } int w1 = w[0], w2 = w[w.size()-1]; int sm = 0; for(int i = 0; i < mp[w1]; i++){ if(sm < l) { sm+=w[i]; ans.push_back(i); } else break; } if(sm <= u) return ans; else return blank; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:14:20: warning: unused variable 'w2' [-Wunused-variable]
   14 |     int w1 = w[0], w2 = w[w.size()-1];
      |                    ^~
/usr/bin/ld: /tmp/ccBXOoQF.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccsXnKLH.o:molecules.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status