Submission #916102

#TimeUsernameProblemLanguageResultExecution timeMemory
916102AiperiiiDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; #define ss second #define pb push_back vector<int> find_subset(int l, int u, vector<int> w) { int n=w.size(); vector <pair <int,int> > v; for(int i=0;i<n;i++){ v.pb({w[i],i}); } sort(all(v)); int sum=0,p1=0; vector <int> ans; for(int i=0;i<n;i++){ sum+=v[i].ff; while(sum>u){ sum-=v[p1].ff; p1++; } if(sum>=l && sum<=u){ for(int j=p1;j<=i;j++)ans.pb(v[j].ss); break; } } return ans; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:12:10: error: 'all' was not declared in this scope
   12 |     sort(all(v));
      |          ^~~
molecules.cpp:16:18: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'ff'
   16 |        sum+=v[i].ff;
      |                  ^~
molecules.cpp:18:22: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'ff'
   18 |           sum-=v[p1].ff;
      |                      ^~