Submission #624286

#TimeUsernameProblemLanguageResultExecution timeMemory
624286VovamatrixDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define MAXN 200007 ll w[MAXN]; ll prefsum[MAXN]; vector<ll> sol(ll l, ll u, vector<ll> w) { ll n=w.size(); sort(all(w)); prefsum[0]=0; for(int i=1;i<=n;i++) prefsum[i]=prefsum[i-1]+w[i-1]; ll itr1=0,itr2=1; vector<ll> v; while(itr2<=n) { if(prefsum[itr2]-prefsum[itr1]>u) itr1++; else if(prefsum[itr2]-prefsum[itr1]<l) itr2++; else { for(int i=itr1+1;i<=itr2;i++) v.pb(w[i]); break; } } return v; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<long long int> sol(long long int, long long int, std::vector<long long int>)':
molecules.cpp:12:10: error: 'all' was not declared in this scope; did you mean 'll'?
   12 |     sort(all(w));
      |          ^~~
      |          ll