Submission #1062616

#TimeUsernameProblemLanguageResultExecution timeMemory
1062616TsotneSVDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#pragma once #include <bits/stdc++.h> using namespace std; /* /\_/\ (= ._.) / > \> */ #define fi first #define se second vector<int> find_subset(int l, int u, vector<int> w) { int n = w.size(); pair<int,int> A[n]; for(int i=0;i<n;i++) A[i] = {w[i],i}; sort(A,A+n); int lo = 0,hi = 0; ll sum = 0; while(hi < n) { sum += A[hi++].fi; while(lo < hi-1 and sum > u) sum -= A[lo++].fi; if(sum >= l) { vector<int> ret(hi - lo); for(int i=lo;i<hi;i++) ret[i-lo] = A[i].se; return ret; } } return vector<int>(0); }

Compilation message (stderr)

molecules.cpp:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:25:24: error: 'll' was not declared in this scope; did you mean 'lo'?
   25 |     int lo = 0,hi = 0; ll sum = 0;
      |                        ^~
      |                        lo
molecules.cpp:29:9: error: 'sum' was not declared in this scope
   29 |         sum += A[hi++].fi;
      |         ^~~