What is you say is correct but, I submitted the brute force one and it's accepted!! I think as the size is 150 its accepted. Here's my solution.

int main() {fastIOint n;cin>>n;vector<int> v(n);for(int i =0; i<n; i++){int x, y;cin>>x>>y;v[i] = x-y;}std::set<int> s;s.insert(0);for(int i = 0; i<n; i++){vector<int> x1(all(s));std::set<int> s1;for(auto x : x1){int a = abs(x-v[i]);int b = abs(x+v[i]);s1.insert(a);

Read more… (28 words)