Submission #490492

#TimeUsernameProblemLanguageResultExecution timeMemory
490492MohamedAliSaidaneDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> //#include "molecules.h" using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef pair<ld,ld> pld; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<pii> vpi; typedef vector<pll> vpl; typedef vector<pld> vpd; #define pb push_back #define popb pop_back #define all(v) (v).begin(),(v).end() #define ff first #define ss second const ll MOD = 1e9 + 7; const ll INF = 1e18; int nx[4] = {1,-1,0,0}, ny[4] = {0,0,1,-1}; /////// SOLUTION \\\\\\\ int find_subset(int l, int u, vi w, int n, vi res) { vpi A; for(int i = 0; i <n; i ++) A.pb({w[i],i}); sort(all(A)); ll pref[n+1]; pref[0] = 0; for(int i= 0; i <n; i ++) pref[i+1] = pref[i] + A[i].ff; int left = 0; int right = -1; for(int k= 1; k <= n; k ++) { if(pref[k] <= u && pref[n] - pref[n-k] >= l) { bool flag= false; for(int i = k; i <= n-k+1; i ++) { if(pref[i]-pref[i-k] >= l && pref[i]-pref[i-k] <= u) { flag = true; left = i; right = i + k -1; } } if(flag) break; } } if(right == -1) return 0; else { for(int i = left; i <= right; i ++) res.pb(A[i].ss); return res.size(); } }

Compilation message (stderr)

molecules.cpp:27:1: warning: multi-line comment [-Wcomment]
   27 | /////// SOLUTION \\\\\\\
      | ^
/usr/bin/ld: /tmp/ccwLPxH8.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