Submission #961241

#TimeUsernameProblemLanguageResultExecution timeMemory
961241aminjon__Detecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; pair<int,int>w2[200012]; int find_subset(int l , int r , int w[] , int n , int result[]){ for(int i = 0;i < n;i++){ w2[i].first = w[i]; w2[i].second = i; } int sum = 0 , left = 0 , right = 0; sort(w2 , w2+n , greater<pair<int,int>>()); while(sum < l && right < n){ sum += w2[right].first; result[right] = w2[right].second; right++; } if(sum >= l && sum <= r){ return right-left; } else if(sum < l || right == n){ return 0; } int last = n-1; while(last >= right && sum > r && left < right){ sum -= w2[left].first-w2[last].first; result[right] = w2[last].second; last--; left++; } if(sum >= l && sum <= r){ return right-left; } return 0; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccenTqd2.o: in function `main':
grader.cpp:(.text.startup+0x18d): undefined reference to `find_subset(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status